Islamic sources actually tell us that Muhammad was a white man. I dont remember if it was in the quran, or the hadiths or whatever, but there is a story of a man who came to look for Muhammad, and his followers told him he was the "white man" laying down in the mosque. There are other verses about his white skin and hair. And there is even a verse from one of his followers about how Muhammad was white, and that anyone who says he was black should be put to death, because he was a white man.
There are also verses where Muhammad makes unfriendly remarks about black people. And we are all aware of the black slaves that existed in Islamic nations.
(Acts 17 Apologists on youtube have a video all about this, with sources and all)
Most people dont actually know anything about Islam, they just follow what others are telling them, without actually looking at the religion itself. (Just like how people will angrily tell you that Islam is a religion of peace, and that you are a bigot and an islamaphobe for saying different, even though the quran and hadiths are filled with commandments of violence) I would imagine Malcom X was the same way, he followed what people told him about Islam, without actually looking into Islam itself.