Born Li Xiuyuan to a former military advisor, Li Maochun, Daoji was born after his parents, who could not have children, entered a temple. Upon reaching the Hall of the Five Hundred Arhats, the statue of Mahakasyapa was knocked off its lotus throne, a sign that the arhat had descended to earth.
After his parents' death, he went to Hangzhou and became a monastic at the famous near Hangzhou. Even though his eccentric behavior broke the rules of the vinaya , it is said that Daoji was kind hearted and was always ready to lend a helping hand to ordinary people. Unlike a traditional Buddhist monk, he ate meat and drank wine. The monks, bewildered and fed up with his behavior, expelled Daoji from the monastery. From then on, Daoji roamed the streets and helped people whenever he could.
According to legends, while cultivating in the Buddha's teaching, Daoji was said to attain magical powers. Many who noticed his eccentric yet benevolent and compassionate nature began to think that he was an incarnate of a bodhisattva, or as a reincarnate of an arhat. He was recognized by the public as the incarnate of the , one of the eighteen legendary arhats.
When Daoji died at the Jing Ci monastery on the 14th day of 5th Lunar month , Taoism began to revere Daoji as a god from heaven and later adopted him as a deity. Not long after that, even Buddhism began to respect his benign and compassionate nature and is involved in many classic koans from Chán Buddhists.
The I Kuan Tao has also adopted him into their pantheon of deities.
Daoji can usually be seen smiling in his tattered monastic robes, and usually carries a bottle of wine in his right hand, and a fan in his left hand. He wears a hat with the Chinese character ''Fo''（佛）, meaning "Buddha". He can also be seen holding his shoes in his right hand.
Daoji in popular culture
*The life of Daoji has also been popularized in a TV series which aired in 1993 called "Legends of Ji Gong."
*Comedic actor and director Stephen Chow portrayed Ji Gong in his 1993 movie ''The Mad Monk''.