In the Book of Ezekiel, God predicts that in the future, a wicked king from the North named Gog, from the land of Magog, will come against Israel and try to defeat it (think ice wall plot in Game of Thrones). They're the distant barbarian hordes that God drags in from the far north. However, the tables will be turned, and the evil king and his whole army will bite the dust:
On that day, when Gog comes against the land of Israel, says the Lord God, my wrath shall be aroused. For in my jealousy and in my blazing wrath I declare: On that day there shall be a great shaking in the land of Israel; the fish of the sea, and the birds of the air, and the animals of the field, and all creeping things that creep on the ground, and all human beings that are on the face of the earth, shall quake at my presence, and the mountains shall be thrown down, and the cliffs shall fall, and every wall shall tumble to the ground. I will summon the sword against Gog in all my mountains, says the Lord God; the swords of all will be against their comrades. (38:18-21)
This little prophecy's had a big influence. In the Book of Revelation, Magog suddenly becomes a person (or being) instead of a place and helps Gog in his evildoings (Rev. 20:8). They're even mentioned in the Qur'an, which says that Dhul-Qarnain (possibly inspired by Alexander the Great) built a giant wall in the North to keep Gog and Magog out (Sura 18:83-98). During the Cold War, some Christian evangelists in America even speculated that the Soviet Union actually was the same as Gog and Magog. (Source).
Regardless of what Gog symbolizes, the story has shades of the Armageddon and "Antichrist" stories built into it. It suggests that before people can live in real peace, there needs to be a massive and violent reckoning, where a ruler representing the forces of evil will be finally and totally wiped out.