I think it's group behavior. I have found through life males and females of a feather still flock together. Sometimes there is the odd person in the group who will not go along with the group, and, will contest the negativity of the group. But, it seems to be rare unless it is generated due to a personal connection. Unfortunately, I know many people who do not like a particular sexuality, race, creed, color, etc. People just need to confront the bigots. Shame others in the group who say nothing. Educate a person. This crap starts early. My wife, who is an elementary school teacher, sees it as early a kindergarten. Where do you think a five year old learns to hate so early in life.
The girl or boy who blurts out to the crowd is a total idiot seeking approval for their stupidity and rude behavior. There is no time clock ticking down to sane behavior. Some will change their beliefs through interactions. Unfortunately some of those interaction may fortify their beliefs. The old adage about painting everything with a broad stroke. There is some merit to the argument that with age comes maturity. It is not until a person is in his or her twenties that he or she becomes a critical thinker. Before that a person can be molded to conform to the group.