Any blanket criticism of millions or billions of people is bound to be highly inaccurate and also have some non zero degree of accuracy just due to the sheer numbers of people and how common these traits are in any population.
Racism is taking the non-zero existence of a complaint and extrapolating it to the broader population without caring to get to know the individual people.
Unfortunately, it was probably an evolutionary survival technique that worked thousands of years ago but has pretty disastrous consequences today.