Being homophobic, etc is rooted in misogyny.
It is rooted in the belief that femininity is inherently lesser and boys are taught that they need to act masculine to become men.
This is why so many of them start harassing anyone who is "feminine." It is learned behaviour.