It's because people like feeling special. Racism is born from the desire to believe that there is something intrinsically "better" about your group than others. Race is an visible distinguishing characteristic that allows people to group themselves. And as well all know, humans like to belong to the "best" group - and even if there isn't a "best" group, they'll find "reasons" to call their group the best group.
And that's where racism comes from. People want to feel pride, and they don't want to have to do anything to earn pride or respect or a sense of community. Rather than work hard to be respected, or bother to find those with similar interests, or take the time to build community relations, lazy people take pride in their race.
I will be brutally honest about it: Being proud of your race is stupid. No matter what that race is. You did nothing to be born the race you are. You had no say in whether or not you were born Caucasian, African, Asian, Pacific Islander, Arab, Persian, Hispanic or Indigenous. You didn't "earn" your race - you were born with it. Likewise, the achievements of others in your race are not your achievements. There's nothing more pathetic than someone deriving their sense of pride and place vicariously through the actions of others.
A white person discovered the laws of electromagnetism. You, even if you are white, did not, and have no right to feel "pride" through it. You can (and should!) respect what Michael Faraday did, but to try to take his achievement and use it to feel good about yourself is stupid. Achievements belong to the individuals who achieved them, and in a way, the society that made it possible.
A Chinese Admiral sailed across the seas and discovered much on his mighty treasure ships. You, even if you are chinese, did not. You have no right to feel pride from Zheng He's feats of exploration. You can respect what Zheng He was able to achieve, but unless it was YOU who sailed around the world on those boats, or unless you helped build those boats, you've got no "right" to feel any sort of pride from what another person accomplished.
An Arab mathematician was the first to discover many of the mathematical laws governing optics. You, even if you are Arab, have no right to feel any sort of "pride" from the works of Alhazen. You respect Alhazen and his enormous contributions to mathematics (and they were considerable). But you yourself did not discover them or help discover them. What right do you have to feel any sort of pride in what another accomplished?
So, I have pretty much demolished any logical reason why anyone would gain pride from race. But people are not logical. People are often very illogical. Deriving one's sense of self-worth from whatever race they are, is easy. It's simple. You don't have to lift a finger. Which is why racism is so popular. Racism allows people to feel special without them having to do a thing to earn it. And it's not enough to glean nonsensical pride from whatever skin colour they have, they've got to put down other races in order to make themselves feel superior.
Now, I've studied my fair share of genetics. I have looked into the genetic differences between races and I have to tell you: going by the best science we have today, the genetic differences between races is so small as to be irrelevant. There exists the same amount of genetic variation between individuals as between races: what I'm saying is that two individuals of the same race will have about the same genetic variation as two individuals of different races. Whites, Blacks, Asians, Arabs - even in supposedly "different" races, many genetic variations are shared. Going by THE BEST evidence we've got, either humanity is all one race or every SINGLE PERSON is their own individual race.
The concept of race itself is fluid and makes little sense. Go back 200 years, and Europeans divided themselves by race in the same way they are quick to divide africans and asians by race. 200 years ago, Irish was seen as a separate race, with the English-Americans looking down on the Irish as "savages", who were all drunks or criminals. Today, they are no longer seen as a "separate" race in the US. In Africa, people will see another group of people as a "different" tribe or race based on the fact that they live on the other side of a mountain, despite the fact that they look the same and are genetically indistinguishable from each other. I can't tell any difference between Chinese and Japanese people, yet all the Chinese and Japanese people I've worked with are adamant that they are two "different" types of people.
It's all nonsense. Genetics and racial mixing PROVE that we are all one species. Skin Colour, facial structure - meaningless, surface differences. I myself am Half-Chinese, Half-Caucasian. I am 100% human. I am just as intelligent, just as humane and just as healthy as anyone else. Yet I am of no one race. I am equal parts Chinese and English, yet I'm no different to any English person or Chinese person that I've met. I can only come to the conclusion that there really are no differences between Chinese and English people. I can donate blood to both of them. I can talk to both of them. Both have the emotions of love, anger, happiness, hate, sadness, longing - both sets of people have the same emotions, the same sorts of lives, and that's because they're of the same species.
But people don't want to acknowledge that. They don't want to feel brotherhood and unity, they want to feel special and superior, so they insist, despite all the scientific evidence we have today, that races are different. Because it allows them (Chinese and English and any other race) to justify atrocities, it allows them to justify their hate and their sense of smugness and why "they" should be the ones to "rule the world".
Also, I should point out, racism isn't a "white" thing. I've lived in many countries and I've talked to many people of all races and there exists racism in every single country under the sun. The Japanese are racist against the Chinese who are racist against the Indians who are racist against the Arabs who are racist against the Persians who are racist against the Arabs as well, and the Russians are racist to the Mongolians who are racist to the Chinese who are racist towards the Indonesians who are racist against Singaporeans who are racist against the Africans, and the Africans have enough racism to go amongst themselves let alone other people, and the Irish are racist against the English who are (somewhat) racist against the Scots. The Germans are racist against the Ukranians who also don't like the Poles who also don't like Italians who are Racist against the Africans. Egyptians are racist against Somalis who are Racist against Ethiopians. The world has so much meaningless, nonsensical racism all due to the fact that people want to feel special and different and superior to each other. A lot of people love the idea that they are better than anyone else, thus deserving of more "rights" and "privileges" than anyone else.
The first instances of racism also came about because people needed a justification to fight and steal from other groups. Skin Colour and Geographical location became that justification. The idea that Blacks were subhuman was invented by whites to justify slavery. The idea that the slavic people's were somehow "subhuman" was invented by Hitler to justify stealing the land. The idea that the Tibetans were "mentally unable to govern themselves" was invented by the Chinese to make them feel better about stealing the Tibetan's land. The idea that some other tribe can be destroyed because they have a different skin colour/language/religion/economic system/clothes is common.
TL

R?
HUMANS CAN BE SELFISH JERKS.