The title of the latest Thor movie, Thor: Ragnarok, is a bit ominous. Subtitling a film "Ragnarok" is basically the Norse equivalent of calling it "apocalypse," or "armageddon," or "end of days." In Norse mythology, Ragnarok is essentially the end of the world — at least temporarily — and in the movie, Ragnarok largely refers to the end of Asgard, and it's basically an extinction level event for the Norse gods. But how does Ragnarok work, exactly?
In the movie, Ragnarok is a future event that has been foretold for generations. The prophecy states that the fire demon known as Surtur will one day burn down Asgard and destroy all of the gods, causing the end of their world and society. It's obviously not something the Asgardians ever want to see happen, but the film sets this event in motion thanks to the Goddess of Death Hela, who hopes to use Ragnarok to reinvent Asgard anew in her image. It's of course up to Thor and his team of Revengers to stop the event before Asgard is destroyed and taken over by Hela. But the movie didn't get its plot from thin air. Like many Marvel Comics-based Thor characters and storylines, Thor: Ragnarok gets its inspiration from the ancient Norse religion.
In Norse mythology, Ragnarok was a predicted future event that told of the end of days, and adherents of the religion believed it would eventually come to pass. The main sources of information regarding Ragnarok come from the 13th Century works today known as Prose Edda and Poetic Edda, which compile a number of Ancient Norse myths. Think of Ragnarok as the Norse equivalent to Christianity's Armageddon from the Book of Revelation in that it describes how the world will end. However, there are some considerable differences in the way Ragnarok would go down compared to other "end of days" myths.
For one, Ragnarok describes the deaths of a number of major gods from Norse mythology, including Thor, Odin, Heimdall, and Loki, as well as the destruction of the world via a great flood. Also, unlike in Christianity, this event isn't really the end of days. Rather, Ragnarok starts a new era, as after the death of the gods and the burning and flooding of the Earth, the world is reborn as a lush paradise to be repopulated by two human survivors: Líf and Lífþrasir. But before the rebirth, there's a lot of bad stuff that goes down all at once.
Ragnarok begins after an exceptionally long winter allows a number of imprisoned bad guys to roam free, according to norse-mythology.org. Loki's sons, the beasts known as the Midgard Serpent and the giant wolf Fenrir, break free. They start wreaking havoc and causing natural disasters all over the world. The ship known as Naglfar, which is made of the fingernails of the dead and contains giants led by Hrym, breaks free from its hold and ferries this army to shore. Loki, imprisoned by the other gods, also breaks free and leads an army of undead from Hel, looking for revenge. The sky then opens up and Surtr, the fire giant upon whom Surtur is based, invades with his flaming sword, leading his own army. These beasts and armies meet up and charge to Asgard across the bifrost, breaking it, and causing Heimdall to blow his horn and wake the gods, calling them to battle. Then, pretty much everyone dies.
Odin is eaten by Fenrir, who in turn is killed by Odin's son Vidarr. Thor kills the Midgard Serpent, but dies from his injuries immediately afterward. Loki and Heimdall kill each other in combat. And the god Freyr is killed by Surtr, who then burns down the entire world. After all of this death and destruction, a new generation of gods rise alongside the two surviving humans, and life begins again on both Earth and Asgard.
Thor: Ragnarok takes a few liberties with Ragnarok, since the actual myth is a bit of a downer, but many of the key elements from the prophecy — Surtur, Fenrir, etc. — do make their way into the film in one form or another.