Why was Archduke Franz Ferdinand killed, thus leading to WWI?
At the time of Archduke Franz Ferdinand's assassination, Serbia was technically independent, yet many Serbs lived in Bosnia, Herzegovina, etc. In 1905, Austria had formally annexed Bosnia and Herzegovina, over which Austria had previously held the right to "occupy and administer." This annexation enraged Serbs throughout the Balkans, but little could be done. Later, a series of wars broke out in which Austria intervened. As a result of the wars, Serbia was forced to cede Albania to Austria. Austria, part of the Austro-Hungarian Empire, had hoped to use its occupation of the Balkans as a buffer against Russian intervention.
A Serbian nationaist group, known as the Black Hand, planned to assassinate Franz Ferdinand while he visited Sarajevo in an attempt to end Austrian occupation of Bosnia. Ferdinand was the heir apparent of the Austro-Hungarian Empire after the sitting Emperor, Franz Joseph, his uncle. By assassinating him, the Black Hand hoped to "decapitate" the Austro-Hungarian Empire. In the end, all they did was set a series of events in motion which led to World War I.
The basic reason for this killing was nationalism. Nationalism is the idea that your kind of people (whether you define that by race, religion, ethnicity, or country) is better than other people. Nationalism also includes the idea that each kind of people, each "nation" deserves to have its own country.
The Austro-Hungarian Empire was ruled by people who were ethnically German. But many of its subjects, like the one who killed the archduke, were Slavs. Slavic nationalists hated being ruled by Germans and wanted to break away from the empire. This was what caused them to assassinate Archduke Franz Ferdinand.