In 1870, Germany unified. It turned from an independent assortment of principalities into one large nation state. It also won a war against France, called the Franco-Prussian War, right around that time.
Once it unified, Germany became a power to contend with. As its wealth and power grew, it began to destabilize the world order, which, for a hundred years, had been based on Britain as the sole superpower and ruler of the seas. Germany started to build up its navy and to build powerful ships called Dreadnoughts.
Giving up its naval dominance was not something Britain planned to do, and it became extremely unhappy with Germany's military decisions. As the two countries became increasingly at odds, both began to enter into alliances with other countries so as to have support in case of war. This led to domino effect of countries declaring war on each other when conflict broke out.
Germany was also the first to declare war, declaring it on Russia on August 1, 1914, triggering a whole set of alliances to come into play. Further, Germany was the first to take aggressive action, invading Belgium on August 3 and also declaring war on France that day. Germany thought it would have a quick victory in France, which did not turn out to be the case.
Germany was not totally responsible for the war, and many historians have argued that better diplomacy in the first weeks of the war could have averted the bloodbath and disaster that followed. However, there is no question that Germany bears a large degree of responsibility. They took a gamble that winning a war would increase their power and prestige, and they lost the bet. Of course, pinning all the blame on Germany after the war was an extraordinarily bad move that only led to another war.