As the capitalist class cemented its control over the economy and state, racist ideas spread. Pro-capitalist thinkers produced supposedly scientific and philosophical theories to bolster racism. But the racism they bred continues. It is not simply a hangover from the past that can be destroyed through educating ignorance away. Modern capitalism constantly reproduces existing racial divisions and invents new ones.
Capitalism is a dynamic system.
It depends on moving workers from one part of the world to another to meet the demand for labour. The US working class, for example, is made up almost entirely of immigrants. Capitalism brings together workers from a range of backgrounds. That has enriched everyone's culture and lives. But workers are also forced to compete with one another on the labour market for resources.