World War I was fought between 1914 and 1918. There are a number of reasons for the war, but the basic cause was a struggle for power between various European countries.
Historians often talk about three causes of WWI. These were nationalism, imperialism, and militarism. Nationalism helped to cause the war by making various ethnic groups want to have more power over their own lives. Imperialism helped cause the war because it made the various European powers compete for larger empires. Militarism helped to cause the war because it caused countries to see military conflict as a good thing.
But what underlies all of these things was a desire for more power. Germany felt that it ought to have more power and status in the world. Countries like France and England feared this. As Germany pushed for more power, the war became more and more likely until finally it erupted when Austria declared war on Serbia.