There are 4 possibilities why many straight men hate gays (homophobia)
Due to fear of gays will do "something" (you know what I mean, right? :D) to straight men
Due to fear of other people will think they (straight men) as gays too if they are hanging out with gays. (threaten their masculinity)
Due to fear of becoming gays in the future
Lack of maturity. They just go along with the crowd who insult gays without sufficient knowledge or experience about them.