It is known that he was from Puyang, but all that is known about his family were the names of several male-line ancestors—great-grandfather He Yan (賀延), grandfather He Hua (賀華), and father He Zhongyuan (賀仲元).
It was said that He Gui was ambitious in his youth and became a soldier during the late Tang dynasty disturbance, becoming an officer under Zhu Xuan the prefect of Pu Prefecture (Chinese: 濮州) in modern Heze, Shandong.
[1] In 882, when Han Jian the military governor (jiedushi) of Weibo Circuit (魏博)(headquartered in modern Handan, Hebei) attacked Tianping Circuit (天平) (headquartered in modern Tai'an, Shandong), which Pu Prefecture belonged to, Tianping's military governor Cao Cunshi (曹存實) was killed in battle.
Zhu took over the army and subsequently successfully defended Tianping's capital Yun Prefecture (鄆州) against Han's attack.
[1] In late 895, Zhu Quanzhong's army had Zhu Xuan's cousin Zhu Jin the military governor of Taining Circuit (泰寧)(headquartered in modern Jining, Shandong) under siege at Taining's capital Yan Prefecture (兗州), when Zhu Xuan sent He Gui and another officer, Liu Cun (柳存), as well as He Huaibao (何懷寶), an officer of his ally Li Keyong the military governor of Hedong Circuit (河東, headquartered in modern Taiyuan, Shanxi), to attack Cao Prefecture (曹州, in modern Heze), to try to see if that attack could help lift the siege on Yan.
Subsequently, when Lei Yangong the military governor of Wuzhen Circuit (武貞, headquartered in modern Changde, Hunan) attacked Jingnan's capital Jiangling Municipality, He Gui withdrew within the city to defend it, and Zhu considered this a display of weakness; he therefore recalled He Gui and replaced him with Gao Jichang.
In 909, he was made the military prefect (團練使, Tuanlianshi) of Xing Prefecture (邢州, in modern Xingtai, Hebei).
[10] Later in 916, Qing Prefecture (慶州, in modern Qingyang, Gansu) turned against Later Liang and surrendered to Qi's general Li Jizhi (李繼陟).
[10] After Qing also fell to him in fall 917,[1] Zhu Zhen rewarded him by making him the military governor of Xuanyi Circuit (宣義, headquartered in modern Anyang, Henan) and giving him the honorary chancellor designation of Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事).
(The chancellor Jing Xiang, however, appeared to be dismayed over the choice, as he submitted petition in which he urged Zhu Zhen to pay more personal attention to the campaign against Jin rather than just leaving it to He Gui and other generals.
After secretly reporting the suspicious to Zhu Zhen, He Gui and a general under him, Zhu Gui (朱珪), lay a trap for Xie and two other cavalry commanders, Meng Shencheng (孟審澄) and Hou Wenyu (侯溫裕), killing them and claiming that they had committed treason.