I once had a racist dog. She was adopted from a shelter. Nearly all of the employees at the shelter were black, so she learned to associate black faces with being in that unpleasant place.
Nothing more to it than that. But she would go absolutely berserk whenever a black person came to the door.
My daughter’s Chihuahua is also racist. Doesn’t much like anybody, but really, really hates black people.