Now, when you have a newly-created nation whose tribes have been fighting each other for centuries, it is essential to integrate them and keep them occupied, so that old divisions don’t crop up. It is essential to give them an overarching common purpose. That’s what Genghis did. He took them on an invasion of China.
This was a retaliatory invasion. Its purpose was to avenge the murder of Ambaghai and to punish the Chinese for centuries of interference and atrocities.
China was ruled at the time by two dynasties: the Western Xia dynasty  in northern China, and the Jin dynasty  in the east. Genghis Khan conquered the Western Xia by 1210, whose emperor agreed to submit to Mongol rule and became a Mongol vassal. He then invaded the Jin dynasty’s territories. He captured and sacked Beijing in 1215 .
In 1218, the Qara Khitai Empire captured a Mongolian city and killed its king, who was Genghis Khan’s grandson-in-law. In retaliation, the Mongols invaded and conquered Qara Khitai , which gave them a direct border with the Khwarazm Empire.
The same year, Genghis Khan sent a 500-man strong trade delegation to Khwarazm to establish official trade relations. The Shah of Khwarazm, Ala ad-Din Muhammad II , who was Jalal ad-Din’s father, had the trade delegation massacred in the city of Otrar . The goods were auctioned off in Bukhara.
Genghis Khan then sent three ambassadors to meet the Shah and demand the governor of Otrar  be handed over for punishm
ent. The Shah had one ambassador beheaded and the other two humiliated, before sending them back. This led the Khan no alternative but war. He retaliated by invading and devastating Khwarazm . The Shah Muhammad II escaped to a small island on the Caspian Sea, where he died. His son Jalal ad-Din became the new Shah, and was pursued by Genghis Khan all the way to India, where what was left of the Khwarazm army was destroyed in the Battle of the Indus, in the year 1221.
Now, when Genghis Khan went on his invasion of Khwarazm, the Western Xia emperor, who was his vassal, refused to provide troops for the invasion. This was a betrayal. In retaliation for this, after conquering Khwarazm, Genghis Khan took his armies back to China and invaded the Western Xia Empire. The territory was reconquered by 1227. He then prepared to invade the Jin Empire again, because they had also rebelled against him.
However, before he could invade the Jin, Genghis Khan died, in the year 1227. The cause of his death remains a mystery. His third son Ogedei, who succeeded him as the Great Khan of the Mongol Empire, completed the conquest of the Jin Empire. His grandson Kublai Khan founded the Yuan dynasty  in China and was this dynasty’s first emperor.