My strictly personal opinion is that it is fear: fear that "someone might become sexually aroused by my nudity" and that, through some mysterious system of osmosis or something, "that might make me gay."
I think much of this can be attributed to a rigid code of morality which views the naked human body as obscene. Remove the fear, or disgust, of nudity and you remove much of the foundation of the fear of gays.
I have no evidence for this hypothesis, only my own feelings and observations.