The most direct cause was the assassination of Archduke Franz Ferdinand of Austria-Hungary by Serbia. Those two countries declared war which then involved their allies. Russia and Germany, each for the opposite side. This then grew to involve alliances which were multiple countries turning this into a world war.
(Gavrilo Princip was the Serbian nationalist who was the assassin.)
I hope this helps.