In virtually all cases where this occurs I have signed up for the mailing implicitly (by buying something from a company and thus establishing a 'relationship') or accidentally (didn't notice they had conveniently pre-checked a 'spam me please' option in an installer or on a website).
And FWIW even for mails I don't want, I do try their unsubscribe link first and use that if it is just a few clicks to get me off the list. If their unsubscribe method is unreasonably complex (any more than two clicks is unreasonably complex, removing me from their database should be just as simple as adding me was), yes, I'll mark them as spam, and I believe they fully deserve it.
Oh, in Mail it might be different if Apple doesn't use that data to train it's default filter. Which seems unlikely.
I guess I don't know if Google does, I just assume they do because they're data junkies.