The area now known as Nanning has been inhabited since the Neolithic Age, when ancient people farmed, fished and hunted in the region. The area received official recognition during the Eastern Jin Dynasty, when it was named the capital of the Jinxing Prefecture, after having been a territory of the Baiyue people.
In the past two thousand years, the area has been given several different names. In the Tang Dynasty, it was known as Yongzhou, usually shortened to Yong, later named Nanning Lu, which translates as ''May Peace Keep in the Southern Frontier''. It became named as a trading town, and was an outpost of many businesses across China: this function seems to have begun sometime in the Song Dynasty. It became an important trading port during the Ming Dynasty, thanks to its place on the Zuojiang River & the Youjiang River, eventually becoming a foreign trade port in 1907.
The city has many times held off against invaders, as a consequence of which it has been given the nickname ''Heroic City''. Su Jian led a resistance during the Song Dynasty against invading forces from Vietnam (known at the time as the Jiaozhi Kingdom). During the Qing Dynasty, the people resisted incursions by the French, and the town played an important role in the anti-imperialist May 4th Movement (1919), the Northern Expedition (1926-28), the Baise Uprising (1929) and the Longzhou Uprising (1930).