I think the first thing about them is that we always create a group to fit in.
Groups tend to do things very similarly even when the individuals in the group are acting alone. It's because they share culture and philosophy and things like that.
When different groups meet together, there are always "representatives" of the group. Even though the person from a group is not quite the definition of the group identity, he or she involuntarily becomes a representative of his or her group. It's because the group simply doesn't know about the other group.
I know my language right now is quite confusing. So I want to share my story.
When I first came to US, there weren't many Asians in my town.
So whatever I did back in the days built a sense of "that's what Koreans normally do" to some of my American friends. They were always asking me "is that normal for koreans?" or something like "that must be a Korean thing," if they were confused or didn't know certain things.
Oppositely, to me, everything my American friends did was quite an "American thing," because I knew nothing about them when I first came. I remember one day, I thought Americans only eat fast food without cooking at home. I mean it's true that fast food is very popular in US, but they obviously cook at home and fast food is not the only thing to eat in US. I was just young and didn't know at that time.
However, as time passed, we started to associate each other in the same group. Slowly, we did not really see ourselves differently for the most of the times because we became similar in many ways. They now understand me as an individual, not as a representative of Korea.
Overall, I think the first reason why prejudice and stereotype are being created is that groups have a group thing, which is quite different from others.
This is just a youtube video, which is talking about the group identity.