He hailed from Fufeng 扶風 (modern Xingping 興平, Shaanxi) and was a court gentleman (lang 郎) during the reign of Emperor Ai 漢哀帝 (r. 7 -1 BCE). When his father was transferred to the post of commander (duwei 都尉) of Henan 河南, Gongsun Shu was appointed member of the suite of the heir (qingshuizhang 清水長). The governor (taishou 太守) of that region highly esteemed him and entrusted to him the administration of five districts. After the usurpation of the throne by Wang Mang 王莽 (r. 8-22 CE) he was appointed governor (at that time called zuzheng 卒正) of the commandery of Shu 蜀 (at that time called Daojiang 導江, modern Chengdu 成都, Sichuan). In the disturbances of the rebellions against Wang Mang he dared to adopt the title of King of Shu.
In 25 CE he proclaimed himself Emperor of Shu (or Chengjia 成家) and chose the reign motto Longxing 龍興 "Rise of the dragon". He had constructed an imperial palace and built up an imperial bureaucracy. Gongsun Shu ruled over the whole territory of the province of Yizhou 益州 (modern Sichuan), a rich region from which he court extract the necessary funds to equip a large army. In 28 CE he decided to conquer the region of Hanzhong 漢中 (along the Han River 漢水, between Sichuan and Shaanxi)but he was defeated byu Feng Yi 馮異, a general of Emperor Guangwu 漢光武帝 (r. 25-57 CE) of the Later Han dynasty.
In 30 CE he sent out an army under Tian Tong 田戎 with the order to conquer the province of Jingzhou 荊州 (modern Hubei), but this campaign was also not successful. Emperor Guangwu sent out an army to conquer Shu in 35 CE and required Gongsun Shu to submit. The emperor of Shu declined and risked war with the Han empire. He personally defended Chengdu and Guangdu 廣都 (south of Chengdu) and died during battle. Shu was consequently reincorporated into the empire of the Han dynasty.