According to the book Shanhaijing 山海經, he was a descendant of Yan Di 炎帝, the Red Emperor, and a son of Zhu Rong 祝融. He was born in the Yangtze River and had the face of a human but the body of a snake and red hair (according to the Lushi 路史).
Gong Gong is so intricately connected with rivers that he kept records of all waters, traveled along their courses and gave them names. Together with his son Hou Tu 后土, the Lord of the Earth, he took care for all hydraulic works in the area of the Rivers Yi 伊 and Luo 洛.
During the times of the mythological emperor Shun 舜, Gong Gong tamed the floods that threatened to inundate the realm. The book Huainanzi 淮南子 says that Gong Gong once fought with Zhuan Xu 顓頊 for the throne of the empire. Their battle was so fierce that the whole universe lost ist balance. This is the reason why all rivers flow to the east. This fight can be seen as a resumption of the war between the Yellow Emperor 黃帝, ancestor of Zhuan Xu, and Yan Di, the ancestor of Gong Gong.
Another legendary opponent of Gong Gong is Gao Xin 高辛 (Di Ku 帝嚳), the battle with whom had the same consequences as that with Zhuan Xu. Gong Gong lost, hid in a deep well, and his family line was extinguished.
The enemy of Gong Gong changes from story to story. Apart from Zhuan Xu and Gao Xin, Shen Nong 神農, Zhu Rong 祝融 and Nü Wa 女媧 are mentioned as his enemies. The apocalpyse of the world was averted because Nü Wa repaired the Heavenly pillar (tianzhu 天柱) that supported Mt. Buzhou 不周山 and the sky.
In the memory of later generations, Gong Gong was overshadowed by Yu the Great 大禹, who also tamed the floods, but was a descendant of the Yellow Emperor. In one story, Yu killed Xiang Liu 相柳, a minister of Gong Gong, which also reflects the struggle between the line of the Yellow Emperor with that of the Red Emperor.
In a younger book, the Shenyijng 神異經, Gong Gong is mentioned as a the name of a people (or individual?) with the same physical characterists as in the ancient tales, but described as of a very bad character.