
In February of 1662, the Dutch left Taiwan, but in June Koxinga died. There are many legends concerning his death; some say he had malaria, others say that he died of depression or sadness His failure at the Nanking battle in 1658 had affected him deeply, and in 1661 the Qing regime
killed his father and brother and destroyed the tombs of his ancestors. In 1662, Prince Gui, one of Zheng Jing, had the last Ming princes, was betrayed, captured and killed. In addition, his elder son a scandalous affair with the nurse of his young brother, even having a son by her - Koxinga went mad with rage and almost killed them. Some believe that such bad fortune contributed to Koxinga's early death, apparently in the prime of life, at the age of just thirty-nine.
Koxinga died in 1662, after his death, the Taiwanese built"Kai Shan Lord Temple" in the early period of Qing rule, to worship Koxinga in appreciation for his contribution to the island, and commemorate his rule.
lln1874, when Imperial General Inspector Shen Baozhen came to Taiwan to organize coastal defenses, he became aware of the great admiration the Taiwanese had for Koxinga, and petitioned the emperor to build a shrine in order to sacrifice to Koxinga officially The Taiwanese raised the funds, and imported the material and architects from Fujian to expand the original site: the result was a Southern Chinese-style building named "Yen-Ping Lord Shrine." 1896, the Japanese Tainan Governor petitioned the Japanese Central Administration to list site as "Kai Shan Shrine" in 1897, it was not only the first shrine in Tainan established by Japanese Government, but also the only Japanese Shrine worshipped the Chinese God.
After the World War II, "Kai Shan Shrine" has been abolished: the name of "Yen-Ping Lord Shrine" recovered, and repaired in 1947. Till 1964, Koxinga Shrine has been rebuilt, and a Northern-style palatial building was erected instead of the Southern-style construction.