Adwords is Googles firehose of money. Their other products help push that or are trying to find new ways to make money.
I think individual engineers looked at things (e.g.) Microsoft made, like Outlook, made it better, and made it free. Nobody should be surprised if the corporate go-ahead was made on the basis of undercutting Microsoft rather than driving ad revenue (at the time).