It is not known when Xu Ji was born, but it is known that he was from Kuaiji. His grandfather Xu Mi was said to be famous in the region. In his youth, he took up residence in the Siming Mountains to study the I Ching from a scholar known only as Lord Jinzheng. At some point, then-reigning Emperor Zhaozong of Tang became aware of Xu Ji's reputation, and summoned him, wanting to meet him. When Xu arrived at the palace, however, Emperor Zhaozong was playing music with actors, and did not see Xu immediately. Xu was unimpressed, and, after meeting the emperor, requested to return to the mountains. He eventually took up residence at Jiangling. After the warlordZhao Kuangming became the military governor of Jingnan Circuit, Zhao treated him with respect and often requested his advice on proper living. In 905, Zhao Kuangming was under threat of impending attack by the major warlord Zhu Quanzhong the military governor of Xuanwu Circuit . He decided to flee to the territory of Wang Jian the military governor of Xichuan Circuit. Xu fled to Xichuan with Zhao. Wang had known of Xu's reputation, and gave him a pavilion at which he could conduct his studies.
During Wang Jian's reign
In 907, after Zhu Quanzhong had Tang's final emperor Emperor Ai of Tang yield the throne to him, ending Tang and starting a new Later Liang, Wang Jian, who was among the warlords who refused to recognize the new emperor, declared himself emperor of a new state of Shu. In Wang's new imperial regime, Xu Ji was made Zuo Jianyi Daifu, a consultant serving at the examination bureau of government. In 913, pursuant to the recommendation of Du Guangting, whom Wang Jian asked for recommendations for virtuous advisors for his son and crown princeWang Yuanying, Wang Jian put Xu Ji and Xu Jianfu on Wang Yuanying's staff. However, Wang Yuanying refused to speak to them, and instead spent his time in games and pleasure with his favorites. Xu Ji was later promoted to be the deputy minister of civil service affairs.
During Wang Yan's reign
In 918, Wang Jian died and was succeeded by Wang Zongyan. Shortly after Wang Yan took the throne, the senior chancellor Zhang Ge, who had closely associated with the eunuch Tang Wenyi — who was executed after an unsuccessful bid to seize power in Wang Jian's illness — was exiled. As part of Zhang's exile, many of Zhang's associates were also demoted or exiled, and Xu was accused to be one and so was demoted. It was said that after quite a long time, Xu was repromoted to be the minister of rites. In 924, Xu was made Zhongshu Shilang, the deputy head of the legislative bureau ; he was also given the designation Tong Zhongshu Menxia Pingzhangshi, making him a chancellor. Around the new year 925, Zhang, who had been recalled from exile, was also made chancellor again. Zhang took the opportunity to retaliate against the administrator Wang Lurou, who had acted against Zhang when Zhang was embroiled in the political storm after Tang's death, by finding an excuse to cane Wang to death. This caused Xu to comment, "Lord Zhang is talented but lacks common sense. Killing one Wang Lurou makes other people fear for their own safety. This is the way to bring disaster."
In 925, Former Shu was destroyed by an invasion of its northeastern neighbor Later Tang. Xu and a number of Former Shu officials, including chancellor colleague Wang Kai, surrendered to the Later Tang army and were taken to the Later Tang capital Luoyang, where he was given the honorary title of minister and allowed to retire. He resided at a mansion where he directed the water to be in the form of a creek, and built a bamboo bridge over it. Citing the cosmological beliefs that bamboos were capable of transforming into dragons, he named the bridge, "The Bridge to Meet the Dragon." It was said that Xu, despite his old age, was still healthy, but spoke very little, other than often speaking, in the Shu tongue, "It is odd. It is odd." He later died by illness in retirement, in 936.