Loki isn't the whole reason that Ragnarok happened but had a lot to do with it. Ragnarok is also known as the Doom of the Gods. The gods had finally settled with the fact that they were doomed and prepared as best they could to fight the giants.
Loki had been tied up and imprisoned for a long time because of the gods' fear of what would happen if he were let out. When Ragnarok rolls around, he is let out of bondage to fight a god named Heimdallr.
Technically speaking, Loki is indirectly the sole reason Ragnarok happens. He is not directly responsible for it though. Let me give you some background for it. Loki’s father is the giant Farbauti( “Cruel Striker”) and his mother is thought to be Laufey( Nal in some sources). Nal might be a goddess or giantess but sources are silent on her true nature.So Loki could be a full giant, half-giant half-god, or simply half-giant. He is treated as a nominal God with a very unique position. He helps both Giants and Gods according to his mood. He is represented as a coward and a wily trickster. He is the father of Hel (Goddess of Helheim or The Underworld), the father of Jormungand( The World Serpent who encircles Midgard) and father of Fenrir(the dreaded Wolf).
Jormungandr and Fenrir are the most important members of Ragnarok out of the three. Loki tricks the blind God Hod into killing Baldr with a mistletoe spear. For this, he is punished by being bound to three rocks with the entrails of his dead son Nari. A snake drops venom on his face which his wife Sigyn collects in a bowl and he waits for Ragnarok there. When Ragnarok finally comes, Loki is freed from his bounds and helps the giants against the Gods even captaining their ship which is set for Asgard. His son Jormungand and Thor engage in a battle till death and they slay each other. Fenrir is also freed from his bounds and his loose mouth encloses everything between the ground and the sky, even the sun. Fenrir is also responsible for killing Odin and the wise Tyr before falling to one of Odin’s sons. At the end of Ragnarok, Heimdall and Loki mortally wound each other but their deaths are not confirmed.