Yelü Deguang was born in 902, before the founding of the Khitan empire (which would later become known as Liao dynasty). His father was the Yelü clan chieftain Yelü Abaoji, and his mother was Yelü Abaoji's wife Shulü Ping; he was their second son. As a young adult, he was described by the History of Liao as serious in his appearance and kind in his disposition, and often participating in his parents' governance of the state.
In 922, by which time Yelü Abaoji was the emperor of the Khitan Empire (as its Emperor Taizu), Yelü Deguang was given the title of Generalissimo of All Forces (天下兵馬大元帥, Tianxia Bingma Da Yuanshuai), and he was put in charge of commanding incursions into the territory of Khitan's southern neighbor Jin. In 923, under him, the Khitan forces captured Jin's Ping Prefecture (平州, in modern Qinhuangdao, Hebei), and also defeated the Huxun Tribe (胡遜) of the Xi. It was said that he later followed Emperor Taizu in defeating the Khitan Jueli Tribes (厥里), forcing the submission of the Dangxiang tribes in the Ordos Loop region, conquering the garrisons of the Hexi Corridor region, capturing the capital of the Gansu Uyghur Kingdom, defeating Balhae, and destroying the Dalugu Tribes (達盧骨).
In 926, Emperor Taizu decided to conquer Balhae. In a campaign, he captured the important Balhae city Fuyu (夫餘, in modern Siping, Jilin). (This appeared to have ended the Balhae state, even though Emperor Taizu did not at this time capture Balhae's capital Longquan.) Emperor Taizu set up a Dongdan Kingdom over the old Balhae territory, with its capital at Fuyu, and made Yelü Deguang's older brother Yelü Bei its king, with the title of "Imperial King of Man" (人皇王, Ren Huangwang), echoing the titles used by himself ("Imperial Emperor of Heaven," 天皇帝, Tian Huangdi) and his wife (Yelü Bei's mother) Empress Shulü ("Imperial Empress of Earth," 地皇后, Di Huanghou). He gave Yelü Deguang the title of "Generalissimo Crown Prince" and made Yelü Deguang in charge of the Khitan capital Linhuang (臨潢, in modern Chifeng, Inner Mongolia), which Yelü Bei had previously been in charge of.
Shortly after conquering Fuyu, however, Emperor Taizu fell ill and died while still at Fuyu. Empress Shulü took over effective leadership of the Khitan, and she and Yelü Bei began the trek of escorting Emperor Taizu's casket back to Linhuang, leaving one of Emperor Taizu's younger brother Yelü Anduan (耶律安端) temporarily in charge at Dongdan. Once then returned to Linhuang, she wanted to divert the succession away from Yelü Bei, as she had favored Yelü Deguang. However, formally, she called an assembly of the chieftains, along with Yelü Bei and Yelü Deguang, and stated to them, "I love both of my sons, and I do not know which one to make emperor. You can decide which one you wish to support by holding his rein." The chieftains, knowing that she favored Yelü Deguang, rushed to him and held to his rein. She thereafter declared him emperor (as Emperor Taizong). Yelü Bei, angry over this turn of events, took several hundred soldiers and wanted to flee to Later Tang (Jin's successor state), but was intercepted by Khitan border guards. Empress Shulü did not punish him, but sent him to Dongdan.