The shipping industry plays an important role in international trade and world economic development. In particular, the rapid growth of the shipping industry since 2020 has become an important factor in supporting and stimulating the rapid recovery of the global economy in the post epidemic era. However, under the background that climate warming has increasingly become the theme of common concern for all mankind, greenhouse gas emission reduction has increasingly attracted the attention of governments of all countries, and has also become the requirement for production and operation of all industries, the green, environmental protection and sustainable development of the shipping industry have also become the focus of participants in all sectors. As environmental problems put forward requirements of a green shipping industry, some policies aimed at reducing pollution and greenhouse gas emissions, such as carbon tax, have brought considerations to the strategies of ports and enterprises, especially concerning their competition and cooperation. This study established a shipping supply chain system composed of two ports and one shipping company in order to analyse the impact of carbon tax on the shipping supply chain, and to optimize the decision‐making of government, ports and shipping companies. Through three‐level Stackelberg game of four models including ports cooperating or not cooperating with each other, and carbon tax levied on ports or the shipping company, the study finds that the collection of carbon tax will reduce the container handling volume of ports thus reducing the profits of both ports and the shipping company, but the handling volume when the government puts carbon tax on ports is lower than that when it puts carbon tax on the shipping company, and the handling volume under the port cooperation mode is lower than that under the port non‐cooperation mode. As the collector of carbon tax, the government's income when taxing ports is higher than that when taxing shipping companies, and when ports cooperate, the government's income is lower than that when ports do not cooperate. Moreover, no matter the ports cooperate with each other or not, the impact of carbon tax on port container handling volume under the mode of carbon tax levied by the government on ports is more significant than that when carbon tax is levied on the shipping company, leaving the former mode a lower container handling volume and lower profit. The findings of this study have the following significance and suggestions for the participants of shipping supply industry: In order to maximize the government's target value, the government should give priority to taxing shipping companies rather than ports; Under the background of carbon tax, ports should choose limited non‐cooperation strategies.