Zhu Shi'an, a 19-year-old freshman majoring in modern literary history, jumps into a river after being rejected 99 times by his dream girl, Liu Ruyan. He unexpectedly transmigrates to the tenth year of the Hongwu reign of the Ming Dynasty (1377), taking over the body of Zhu Shi'an, a spoiled young wastrel with the same name, son of the magistrate of Fengyang County.
The original owner was a dissolute spendthrift who frequented brothels and caused trouble. He eventually died in a prostitute's bed, earning a terrible reputation. Armed with modern knowledge, the transmigrated Zhu Shi'an begins his comeback as the "Brothel Ghost," despised by the entire city. He stuns the literary world with a poem, "Immortal at the Riverside," revives Fengyang's economy with a soap-and-glass business, and wins the people's favor with improved gunpowder and the curved-share plow. He goes on to sweep the imperial exams, placing first in all three stages, then wins the palace exam and is personally named top scholar by Zhu Yuanzhang.
At court, his foresight lets him rewrite history: he saves Empress Ma, Crown Prince Zhu Biao, and imperial grandson Zhu Ying, all of whom were destined to die young. He improves agriculture, firearms, shipbuilding, and machinery, bringing the Ming Dynasty to the dawn of industrial civilization ahead of its time. Ultimately, he leads the army east to crush the Japanese pirates and west to conquer the Western Ocean, expanding the Ming territory across the globe. He becomes the "Ming Dynasty's Greatest Imperial Tutor" and completes his transformation from a lovesick doormat into a true dragon.