It does not. It goes against a very specific concept of investment, which is that I should be able to buy a thing and make money with absolutely zero regard for anybody else. It is not a rule of the universe that owning something should allow me to harm others.
But this isn't about what rights a company has. This is about the obligations a board has to act on behalf of its shareholders within legal limits.
Please don't confuse my comments for an approval of public companies choosing financial gain over the good of others. This is one of the primary reasons why I am very critical of companies going public. Going public essentially means a company sells its soul for investment money. The owners and investors may see a big payout, but the potential long-term good a company can do is handicapped as soon as it goes public.
Hence the idea that anything is justified as long as it gooses the stock price, and that a corporation has no social obligations whatsoever.
In reality, there has been more or less exactly one successful invocation of the concept in history, against Craig Newmark, when he explicitly said he was going to do something that would harm shareholders.
In reality, you do whatever you want and if anybody complains you tell them it's good PR and will therefore benefit shareholders in the long run. You can be as wrong about that as you want as long as you manage to avoid explicitly stating that you know to be wrong.
I know very little about public trading or the laws regarding it - especially compared to many other HN users - but here's my novice response:
Think about why that's a rule. The board doesn't own the company; the shareholders do. The board's role is to make decisions on behalf of the shareholders. The rule exists to ensure they do exactly that.
A board deciding to financially harm the investors they represent for the "good of humanity" goes against the very concept of investment. A public company intentionally acting against the financial interests of its owners would see its stock value immediately collapse, causing immense damage to its shareholders, employees, and customers.
If you want a company to act "for the good of humanity", it has to either be privately owned or align with the financial interests of its investors.