> Companies exist to make money
Fiduciary duty isn't the same as company mission or purpose.
If Google did not provide some sort of product or service it would not need to exist as a company. Even if Google were a pure research lab without obvious consumer or business products or services it would still be doing non-financial work that someone thought provided some kind of benefit.
Investors are not Google's only stakeholders. Without customers or employees (for example) Google would cease to exist. Google may also discover that the general public is another stakeholder.
Google's mission statement[1] isn't actually "to make as much money as possible" or even "to provide maximum value to shareholders" but rather "to organize the world’s information and make it universally accessible and useful."
[1] https://about.google/intl/ALL_us/