Long story short, Europe was slightly ahead of Africa in terms of development when they began to really interact, around the time Europe found out about the Americas they had a bunch of new land from genocide of the natives and needed manpower Europeans could never hope to fulfill, so the slave trade started in earnest.
Europeans would only trade their goods for slaves, which started the slave industry in various African nations that wanted these goods, which stalled development in Africa while dramatically increasing development in Europe, widening the gap until the colonial era. Over time, this gap began to increasingly be seen as its own justification, and Europeans became increasingly racist towards Africans.
It isn't about inherent evil. Europe was beginning to become capitalist while the most developed nations in Africa were developed feudal kingdoms, and the geography of Africa and Europe had more to do with that than any genetics could ever hope to cover. The narrow gap was exploited by Europeans and widened until the modern era of imperialism and neocolonialism.
I highy recommend How Europe Underdeveloped Africa by Walter Rodney. We're doing a readalong over in Hexbear.net if you want to join!