Several reasons can be cited as the reason for the World War I but if we take the reasons only in the immediate context that caused the war you can say that it is the murder of Archduke Franz Ferdinand that caused the war. He was the heir to the throne of Austria and Hungary and he was killed along with his wife.
The person who murdered the prince and his wife was known as Gavrilo Princip and was the member of 'Young Bosnia', a group whose sole aim was to unify the south Slavs and get independence from the rule of Austria and Hungary. After the murder, chaos was prevalent every where and it is the series of events that led to the full scale war in which several nations allied together to form a group.