Zheng Sen was born in 1624 in Hirado, Hizen Province, Japan, to Zheng Zhilong, a Chinese merchant and pirate, and a Japanese woman, recorded only by her surname "Tagawa", or probably Tagawa Matsu. He was raised there until the age of seven with the Japanese name Fukumatsu (Japanese: 福松), and then moved to Nan'an county in Quanzhou in Fujian province of China.
In 1638, Zheng became a Xiucai (a successful candidate) in the imperial examination and became one of the twelve Linshansheng (廩膳生) of Nan'an. In 1641, Koxinga married the niece of Dong Yangxian, an official who was a Jinshi from Hui'an. In 1644, Koxinga studied at the Imperial Nanking University, where he met and became a student of the scholar Qian Qianyi.
In 1644, Beijing fell to rebels led by Li Zicheng and the Chongzhen Emperor hanged himself on a tree at modern-day Jingshan Park in Beijing. Manchu armies aided by Wu Sangui's forces defeated the rebels and took the city. The Ming remnant forces retreated to Nanjing where they put Prince Fu on the throne as the Hongguang Emperor in an attempt to continue the Ming dynasty in the south. The next year, the Manchu armies led by Dodo advanced south and conquered Yangzhou and Nanjing while the Ming leader defending Yangzhou, Shi Kefa, was killed. The Hongguang emperor was captured and executed.