Sima Rui was born in 276 into the royal family of the Western Jin Dynasty as the Prince of Langya. During his youth, the Jin Dynasty was severely weakened by internal power struggles known as the War of the Eight Princes. In 311, nomadic tribes invaded northern China, sacking the capital Luoyang in the Disaster of Yongjia. Anticipating the collapse of the central government, Sima Rui relocated his court to Jiankang (modern Nanjing) south of the Yangtze River, securing a safe haven for the Han culture.
Following the total destruction of Western Jin, Sima Rui was proclaimed emperor in 318, founding the Eastern Jin dynasty as Emperor Yuan of Jin. His ascension relied heavily on the political and military support of the powerful Wang clan of Langya, led by Wang Dao and Wang Dun. Their influence was so absolute that a popular saying arose: 'The Wangs and the Simas share the world,' establishing a system where the monarch ruled in partnership with powerful aristocratic families.
According to legend, when Sima Rui crossed the Yangtze River to flee the north, a divine dragon emerged to guide his boat safely across the water, which was interpreted by the people as a sign of heavenly approval for his reign. Although he was unable to reconquer the lost territories of the north, Sima Rui successfully preserved the cultural heritage and political legitimacy of the Jin Dynasty in the south.