I can't read their minds to see their true motivations, but it seems to me that the message "even I, Warren Buffett/Bill Gates, multi-billionaire and champion of industry, recognizes that I have a responsibility to my fellow human beings, and that as I have receive much from society, it is my duty to give much back." I think it's very positive.
It reflects well on them, sure, so I don't know whether they were going for the glory of being seen as nice people or they were actually giving out of the goodness of their hearts. However, it seems to me that if they were just going for an image-building exercise, they could've got almost the same effect for much cheaper.