The Orkhon valley was a centre of the Xiongnu, Göktürk and Uyghur empires. To the Göktürks, the nearby Khangai Mountains had been the location of the Ötüken, and the Uighur capital Karabalgasun was located close to where later Karakorum would be erected (downstream the Orkhon River 27 km north–west from Karakorum). This area is probably also one of the oldest farming areas in Mongolia.
In 1218–19, Genghis Khan rallied his troops for the campaign against the Khwarezm Empire in a place called Karakorum, but the actual foundation of a city is usually said to have occurred only in 1220. Until 1235, Karakorum seems to have been little more than a yurt town; only then, after the defeat of the Jin empire, did Genghis’ successor Ögedei erect walls around the place and build a fixed palace.
Ögedei Khan gave the decree to build the Tumen Amgalan Ord (Palace of Myriad Peace, Wan’an’gong in Chinese) in 1235 the year after he defeated the Jin Dynasty. It was finished in one year. In the Yuanshi (元史) it is written in the section for Taizong (太宗) Ögedei Khan: In the seventh year (1236), in the year of the blue sheep the Wanangong 萬安宫 was established in Helin 和林, Karakorum. One of Genghis Khan’s nine ministers the Khitan Yelü Chucai(1190–1244) said the following poem during the ridge raising ceremony of the Tumen Amgalan Ord: “Installed ridge well fit and stone foundation, The parallel placed majestic palace has been raised, When the bells and drums of the Lord and officials sound pleasantly, The setting sun calls the horses of war to itself from the mountain peaks.” The Mongolian version of the poem is as follows: “Tsogtslon tavih nuruu chuluun tulguur, Zeregtsen zogsoh surleg asriig bosgovoi, Ezen tushmediin honh hengereg ayataihan hanginan duursahad, Echih naran uuliin tolgoigoos dainii agtadiig ugtnam.
The name Karakorum or “Kharkhorin” literally translates to ‘black-twenty’. But linguists argue that the ‘khorin’ might have been a diversion of the word ‘khurem’, which means “castle” in Mongolian. Other translations vary.