Trope described: Humans live (quite far) away from race/species/distinct group of people called X. There is a lot of negative stereotypes about the X. They are all dishonorable, thieves, murderers, chronic liars. Or they are all criminally insane. Or they are all crazy inventors whose inventions are impressive but tend to explode and the inventors themselves are all cackling messes. Or they are all Lawful Stupid fanatics.
Whatever the stereotype, it is important that it is: a) negative and b) considered to be about the whole group X.
The protagonist lives their whole life believing the stereotypes. In fact, the few members of group X he meets fit the stereotype to a T.
The truth is very different. The group X is actually very like us (or protagonists). Except X live in very sheltered and closed society. As a rule, they don't let strangers in. And they don't leave their territory or try to spread it.
The only exception is their criminals and malcontents. X don't have the death penalty. Their ultimate punishment is banishment. The stereotypes exist because the only people X you're going to meet are actually criminals and generally considered unfit to live in X society.
And I don't mean Planet of Hats trope, where all Klingons are warriors, all X are spies etc. Or that there exists a stereotype that all X are warriors following warrior code of honor, because your first and every meeting with X was with their warrior caste defending their homeland. There is My Species Doth Protest Too Much, but that is about one member of Planet Of Hats species who doesn't fit the mold.
I mean that whole X group is stereotyped because the only X guys you meet are actually what group X consider to be dangerous criminals deserving of ultimate punishment banishment.
Now, my question is: what is the trope name and what are the earliest examples of it?