Repressed feelings of same-sex attraction
Human sexuality is not binary. It is a fluid continuum all the way from completely-homosexual to completely-heterosexual.
Many individuals in the middle of the spectrum experience some degree of same-sex longing and attraction, but the majority are constrained from acting on these feelings due to the social consequences they believe would accompany a perception that they are anything other than completely-straight.
This ongoing conflict makes these individuals highly prone to suffer from homophobia and to engage in homophobic compensating behaviors in order to mask their true feelings.
People tend to dislike that which they secretly want, but feel that they shouldn’t have.
Supposed scriptural prohibitions of homosexual acts
Individuals who possess strong religious beliefs but who lack the capacity or inclination for critical independent judgment can frequently be induced to homophobia by (already homophobic) leaders who cite obscure scriptural verses which they interpret to prohibit homosexual acts.
Although temporarily swayed by these citations, unless constantly reinforced, this type of homophobia will usually subside due to the fact that these few anti-gay references are generally at odds with the more central tenets of religious teachings.
The demonization of homosexuals
Gays and lesbians have long been used by homophobic religious and political leaders as convenient foils for wedge politics and the politics of distraction. The idea, for example, that there is a "homosexual agenda" that if not actively-countered will somehow lead to the decline of civilization has been widely-used to rally right-wing voters.
Although the perpetual use of these "us versus them" tactics has contributed to negative attitudes toward homosexuals, the efficacy of such tactics is diminishing over time.