In some cases, maybe many, it's simply reaction formation, to wit:
"One of the most significant things about the research that Bering discusses in his article is that these young homophobic men admit to violent feelings against homosexuals and admit that they would want to act out that violence if they saw two men in public being affectionate towards one another.
It would seem that the findings lend support to the Freudian defense mechanism called 'reaction-formation,' in which anxiety-producing or unacceptable emotions and impulses are mastered by exaggeration of the directly opposing tendency. In other words, the homopobic young man who has violent urges is really hiding strong homosexual feelings and impulses that cause him so much anxiety that he must cover them up by acting violently. Most probably these young men are unaware of their homosexual wishes.
As with so much hatred, there is the tendency to hate in others that which we find unacceptable in ourselves. This is the basis of 'scapegoating' in which a victim is selected and bullied because they exhibit some characteristic that the bully does not like because he perceives in himself.
The importance of the findings in this research is not to imply that homophobic men are truly homosexual but that all human beings experiences varieties and types of feelings and impulses but that these do not define who they are. As Freud pointed out so long ago, human beings are 'polymorphous perverse,' which has to do with having all types of sexual feelings. The homophobe finds these feelings so terrifying that he must lash out at others who truly are gay."