The Chu–Han Contention and the Founding of Han
Also called: Battle of Gaixia, Chu–Han War
After Qin fell, Xiang Yu of Chu and Liu Bang, King of Han, fought for the realm. Victorious at Gaixia, Liu Bang became emperor, founded the Han dynasty and made Chang’an his capital.

Unknown Chinese artist · Public domain · Source
With Qin gone, Xiang Yu proclaimed himself Hegemon-King of Western Chu and parcelled out fiefs, sending Liu Bang west to Hanzhong as King of Han. Liu Bang soon seized the Guanzhong heartland and, served by men such as Zhang Liang, Xiao He and Han Xin, fought Xiang Yu for more than four years (the Chu–Han Contention). Surrounded at Gaixia in 202 BCE and hearing Chu songs on every side, Xiang Yu broke out and fled, then killed himself at the Wu River.
Liu Bang (Emperor Gaozu) took the throne, founded the Han and made Chang’an his capital. He eased Qin’s harsh laws and heavy taxes and adopted the commandery-and-kingdom system: commanderies and counties near the capital, with distant regions granted to meritorious followers and kinsmen as vassal kings. After being surrounded by the Xiongnu at Baideng in 200 BCE he made peace by sending a princess and tribute. When the vassal kings grew too strong, Emperor Jing crushed the Rebellion of the Seven States (154 BCE) and effectively restored direct rule.
In the turmoil of early Han, when the King of Yan, Lu Wan, fled to the Xiongnu, Wiman of Yan led a band into Gojoseon and later seized its throne (194 BCE).