Yen received his formal military training first in China and later at Imperial Japanese Army Academy. In Japan he became a member of Sun Yat-sen's and following the 1911 Xinhai Revolution he seized power in the province of Shanxi. Though a member of the Beiyang Army and affiliated with Duan Qirui, he avoided the violent national politics of the time by enforcing a neutrality policy on Shanxi, which freed his province from the . Taiyuan, the site of the one in China that could manufacture field artillery, also helped to secure his neutrality and his hold on the province. This ended when he joined the Kuomintang as it became clear it would be victorious.
Although Yen was known as the "Model Governor" for his enlightened policies, he was nonetheless a . In 1926, he pledged his loyalty to Chiang Kai-shek's new government, but in 1929 he joined Feng Yuxiang and Wang Jingwei in their attempt to overthrow the Chiang administration. During the Central Plains War, Yen joined Feng Yuxiang to fight Chiang Kai-shek, but both were defeated when Zhang Xueliang decided to join Chiang. Yen was forced to flee Shanxi to Dalian after his defeat, but after a brief retirement in the early 1930s, Yen returned to power in Shanxi and undertook social and military reforms to counteract the spread of communism in the province. Ironically, Yen's success to check the spread of communism was largely due to his adoption of many policies advocated by the communists, which targeted the problems of the nationalist regime: under the agreement reached between Yen Xishan and the Shanxi communist leader Bo Yibo, who had the approval of Mao Zedong, Yen authorized communists in Shanxi to implement many reforms for his regime. As Yen implemented the reforms under his reign, the popular resentment against his regime decreased, but this did not mean that Yen's relationship with Chiang Kai-shek had been improved as a result, and in fact, Yen supported Zhang Xueliang's seizure of Chiang Kai-shek in the 1936 Xi'an Incident.
During the Second Sino-Japanese War, most regions of Shanxi were overrun by the , but Yen refused to flee the province and after losing the provincial capital Taiyuan, he relocated his headquarter in the remote corner of the province, and then effectively resisted Japanese attempts to completely seize Shanxi. During the Second Sino-Japanese War, the Japanese made no less than five attempts to negotiate peace terms with Yen and hoped that Yen would become a second Wang Jingwei, but Yen refused and stayed on the Chinese side.
After , his troops held out against the communists during the Chinese Civil War and attempted to rid Shanxi of communists by launching one of the first post World War II nationalist campaigns against the communists with Chiang Kai-shek's authorization. Much to the dismay of Kuomintang, Yen Xishan and his fellow commanders proved to be absolutely no match for his communist enemy Liu Bocheng and Deng Xiaoping, losing 13 of his best troops totaled more than 35,000 in less than a month during the Shangdang Campaign. Yen's failure strengthened Mao's position in the peace negotiation in Chongqing and helped the communists to achieve better terms for themselves while winning the sympathy from the general populace. One of the main reasons for Yen's failure was the loss of popular support, because Yen Xishan viewed the many reforms communists helped him to implement during the Second Sino-Japanese War only as emergency measures to survive the Japanese pressure, and as Yen attempted to abolish these reforms that had won him great popular support, such as the tax and rent reduction for tenant peasants and small business owners, Yen's regime in the post war era lost the popular support it once enjoyed during the war, and thus drove the general populace to the communist side.
Despite all those debacles, however, Yen Xishan refused Chiang Kai-shek's help after his defeat, fearing Chiang would take the opportunity to take over his turf. As a result, in the following campaigns against his communist enemy, Yen and his commanders once again proved to be absolutely no match for his fellow Shanxi colleague Xu Xiangqian, who was on the communist side. During the first stage of the Central Shanxi Campaign in the central part of the Shanxi province, Yen Xishan managed to have his best 100,000 elite troops with absolute numerical and technical superiority to be completely wiped out by Xu Xiangqian's mere 60,000 strong force in less than six weeks. Unwilling to concede defeat, Yen Xishan immediately sent another a quarter million crack troops of his against Xu Xiangqian's 60,000 strong force, hoping to defeat communists by not letting them to have the opportunity to regroup and recover from the previous battles, only to have another 200,000 out of the quarter million to be killed by Xu Xiangqian's communist force in less than 17 months that followed. Yen's loss of his best 300,000 troops within 18 months was a serious blow that Yen could never recover from, and it marked the beginning of the end of Yen's reign in Shanxi. Though it was Yen who refused Chiang's help out of fear of losing his turf, Yen nonetheless blamed Chiang for his failure after these defeats, and supported Chiang's rival Li Zongren.
Although Yen's force was nearly wiped out by the numerical and technologically inferior communist force led by his Shanxi colleague Xu Xiangqian, Yen did succeed in buying valuable time to strengthen the defense of the provincial capital Taiyuan because the communist force needed the time to recover, regroup and prepare for the final assault of the provincial capital. Yen was so confident in the defense of the city that he promised that he would die in the city. However, when the inevitable final assault on the provincial capital begun, Yen and his commanders again proved that they were absolutely no match for Xu Xiangqian: during the Taiyuan Campaign, Yen's force of more than 130,000 with numerical and technical superiority not only failed to defend the city against the numerically and technically inferior 100,000 strong communist force led by Xu Xiangqian, but was also devastated by the communist forces in the desperate and hopeless battle. Just shortly before the fortress city of Taiyuan fell in April 1949, Yen betrayed his own promise of dying with the city and fled with the provincial treasury to Guangdong. After reaching Guangdong, he soon fled to Taiwan along with the rest of the Republic of China government on 8 December, 1949. From 3 June, 1949 to 7 March, 1950, he served as Premier of the Republic of China first briefly in Guangdong and then in Taiwan. He died in Taipei, Taiwan.
After the Communists took over, Yen, like most Nationalist generals who did not switch their sides, were demonized in the communist propaganda. It was not until after 1979, when the reforms started in China, that Yen was viewed more positively , and the contributions by Yen during his reign are beginning to be recognized by the current Chinese government. One of this achievements, namely Yen's success in containing one of the epidemics in Shanxi, was quoted recently by various Chinese governmental organizations as an example to follow to contain the and epidemics in China, and as criticism of the incompetence of Chinese governmental officials in such epidemics.