The reputational aspect is definitely a big part of it - they want to be seen and remembered a certain way. Bill Gates is a good example, but he blew all that up by raping children (maybe). Before the Gates Foundation, he was viewed by the public as a typical evil miserly cutthroat businessman who was also a weird nerd. Gates Foundation & making sure everyone knew about it did a lot to sway public opinion.
And the actual people at the Gates Foundation did great work - they helped to control and eradicate deadly diseases in the global South. But it isn't like Bill was doing that work, he was just allowing someone to cut the checks.
And it allows them to avoid taxes. They choose to pay bribes to politicians instead of paying taxes & to continue to not pay taxes.