Let’s say you decide to try something new, a dish from a cuisine you’ve never tried before, and you don’t like it. It’s possible that you don’t bother eating any other recipes in the cuisine because of this one experience.
The same generalizations are made about people. It’s very common for people to make the mistake of forming an opinion with a negative connotation, and no validity on an entire demographic because of one experience/encounter.
The human brain constantly uses past experiences to interpret new ones, so unless you take conscious control of your thoughts, your mind will revert to what it does naturally: create connections and establish generalizations from prior experiences without giving each individual respect as a person. For example, judging them from circumstances, characteristics, race etc.
Through self-awareness you can monitor and avoid thoughts based on unfounded judgments, opinions, and prejudices. One way to do this, is to take the time to learn about individuals that you might find yourself generalizing from existing beliefs that are usually biased. You can’t generalize when you get to know individuals for who they really are because everyone is different. The more you learn about people the more your thinking expands and becomes inclusive rather than limited and shallow.