That's because HIV is almost always passed by drug abuse i.e needles. The reason it's correlated with gay men, is because they just happen to perform a sexual act that results in higher chance of blood mixing i.e taking it up the ass.
That being said (and contrary to what people actually believe), most gay men with HIV got it from sharing needles with their HIV/AIDS ridden partner (not the sex). You just don't get the same viral load during sex that you would from a needle being stuck straight into the source.Its not impossible, sure; its just far more likely drugs are involved (and the issue).
Plus, even a needle needs to be exchanged quite a few times for you to be infected indefinitely (on top of shit health i.e drug abuse). I've heard of freak incidents where a completely healthy physician/patient gets completely stuck/injected with contaminated blood samples, and they didn't even get infected. I DO NOT RECOMEND, but either way our knowledge on transmission of HIV has increased greatly over the years.
Hell, just had a middle aged female patient come in the past year, and learn she's been carrying HIV for years and didn't know. She struck me more as a secret junky than some hookup sex fiend.