I agree that buying on the secondary market doesn't directly give money to the company. However, it increases demand (and therefore price) of shares in petrol companies, which might help them raise more money per share for new projects.
The earnings coming from such shares also comes from actively encouraging CO2 producing activities. Some people don't want to earn money that way, because they think it is morally wrong.