Two different countries, two different set of reasons and two different historic time frames.
• China: The sea ban was called <em>Haijin </em>in Chinese. It was imposed during the 14th century by Zhu Yuanzhang, the Hongwu Emperor due to a series of factors, including a very deadly and recent bubonic plague pandemic, Japanese piracy, the aversion of Neo-Confucianism towards Mercantilism, xenophobia and a very absolutist and monarchic conception of Chinese power as a “heavenly empire” with a quasi-divine emperor who did not send emissaries abroad. Foreign “vassal” states sent their emissaries and tributes to the “divine” Chinese Emperor. Any attempt to carry out private commerce outside of China was a capital crime, punishable by death and the offender’s family was subject to exile.
• Japan: The severe border restrictions were called <em>Sakoku </em>or closed country in Japanese. The main reason was that the ruling Shogun was extremely aware of the possibility of Spanish and Portuguese colonial powers using the spread of Christianity as a pretext to intervene in domestic Japanese affairs and colonize the country. With the arrival of Christian missionaries, many Japanese peasants were converting to Christianity and because of the egalitarian, fraternal and ethic tenets of the Christian faith they started questioning the divinity of the Emperor and the absolute power of the Shogunate. In order to prevent foreign colonization and to ensure local compliance with shogunate rule, foreigners were banned from the country under penalty of death. Only the Dutch and the Chinese were allowed to operate and conduct businesses in the country but without a permission to venture further than the port where they conducted business and trade.