Firstly, I have a huge respect for Bill Gates along multiple axes. I also believe the B&M Gates Foundation does outstanding work for good reasons.
As I understand it, in the US you can donate an asset that has gained in value and claim the market value as a deductible charitable contribution without paying tax on the capital gain of the donated asset.
High earners in California, for example, pay a marginal tax rate on capital gains close to 33% and a marginal tax rate on ordinary income close to 50%. Imagine you own $3M worth of EvilCorp stock that you purchased for pennies back in the day.
If you sell it all you will keep around $2M. If you make a gift of stock to charity, you can deduct the $3M charitable contribution and shelter $3M of ordinary income gain reducing your tax liability by $1.5M. You get almost as much cash in your pocket plus you can choose how the $3M charitable contribution is spent. YMMV, AMT is a thing.
The donation can even go to your own "donor-advised fund", or to your own name-brand foundation if you replace M with B. The donation could also buy tickets to glossy fundraiser events for you plus one. Among the perks, you are known around town as a philanthropist and all-around good guy.
Actually changing the world for the better with your charitable contribution is non-trivial. For that you need someone like Bill Gates.