The science shows that we are born at least a little racist. The best explanation I've heard is mirror neurons.
It makes sense that it is easier to empathize and form alliances with people who look similar to you. Part of growing up and being an adult is overcoming some of this instinctive behavior but it's always with us. Children have both mean streaks and generous streaks in their personalities; parents and others must encourage the good and discourage the bad.
It's just part of human nature.