Promoting the development of green industries to facilitate the growth of green finance has become a consensus among various sectors of society. This article focuses on the game theory strategies between governments and polluting companies in the context of green finance. Taking the Prisoner's Dilemma game model as an example, we discuss if polluting companies, under different types of governments, would choose to allocate loans towards improving production and environmental projects. Furthermore, we analyze whether the preferences of the general public towards eco-friendly products would influence the game strategies of governments and polluting companies. Through solving the model, we find that when governments increase penalties for polluting projects, reduce the costs of environmental project research and development for polluting companies, enhance environmental awareness among the general public, and stimulate their preference for eco-friendly products, they can strengthen corporate social responsibility and promote green investments. Consequently, polluting companies are more likely to invest in environmental projects to gain greater returns.