Gog

The Gomagog were a race of Great Old Ones. (PROSE: Divided Loyalties) In Earth's mythology they were known as giants; (TV: The Stones of Blood) the Bible called them Gog and Magog, while in the Koran they were known as Yajuj and Majuj. (AUDIO: The Feast of Magog)

They could possess other beings, and claimed to see everything, having watched over Earth since Humanity's ancestors climbed down from the trees. (AUDIO: The Feast of Magog)

They were creatures that featured in the history and mythology of countless cultures across the universe. The Book of Magog said they came from "the space between the spaces, [...] conquering and ending all worlds in all universes." Some believed them to be a dark emanation of the Archive. (AUDIO: The Archive) Detailed in History of Earth, they were marauders, destroying many worlds across many dimensions, traveling across all realities and destroying every reflection of themselves until they were the only manifestation. Through a tear in the very material of space, they were meant to invade Earth in the 21st century; Iris Wildthyme believed they did invade Earth in a parallel universe, (AUDIO: Kronos Vad's History of Earth Vol. 36,379) since they used wormholes to destroy every version of every planet, including their own. (AUDIO: The Phantom Wreck)

Other references
The Fourth Doctor believed that the myth of Gog and Magog was inspired by the Ogri of the Nine Travellers. (TV: The Stones of Blood). He also encountered an individual called Magog in a parallel universe. (COMIC: The Iron Legion)

Behind the scenes
Gog and Magog is originally a Biblical reference. The Doctor, however, is referring to English legends.