Keep in mind also the media they might consume. I mentioned anime cosplaying in real life - and I mean it. Now, look at how anime depicts women. They're sexual objects for men's enjoyment and entertainment.
But perhaps the biggest reason is men tend to get... overly confident in male-dominated spaces. This is something I've noticed since I was a child. All bets are off in locker rooms or at the poker table or in an online game. It's an opportunity to say the vilest things imaginable.