A lot of people don't really understand what a stereotype is.
All it means is that it is a generalization about a group of people that is widely believed, or seen as a sort of "pattern" or typical.
It may, in terms of the group, be an accurate generalization, or not. The mistake is really assuming or behaving as if the stereotype will apply to all individual members of the group.
There are all kinds of things we can say about statistics about groups of people that are true. That a certain group is more likely to be wealthy, or poor, or that there are differences in educational attainment, or one is taller, or the size of genitalia, or a certain group is more likely to be agreeable.
Statistically, these things can be absolutly true, and that means that in some cases we may tend to expect members of that group to be like that, or treat individuals as if they are like that.
But the error is that you cannot apply group stats and patterns to individuals. It's unfair, but it's also a misunderstanding of how statistics work.
Of course some stereotypes are just untrue. Why myths like that arise is varied - sometimes there are historical reasons that make sense, sometimes it can be attempts to disparage a group, but sometimes it seems weirdly random.