A guy says "What are doing that for, faggot". He is not secure in his masculinity or sexuality. He may or may not be straight, its largely irrelevant. He knows gay is bad, and that morphs into anything bad is gay. He will needlessly perform his gender and sexuality, even in ways that are harmful to him and others.
His friend hears this and adjusts his behavior. He might not be gay. He might not even be openly homophobic. But even associating with the concept (much less actual gay people) is suicide. Doesn’t matter what he was doing. It is "gay" and should stop. He wants his friends approval.
Some other boy passing by overhears. He definitely is gay. He does not behave stereotypically gay (its fine either way). He knows what others really think of him. Never mind whether he has hookups / partners, never mind whether he acts feminine, never mind whether he even identifies as gay. He lives in constant fear of being "discovered". Long after the comments, he knows that he is lesser than and unworthy of love or respect.