I’m guessing Malcolm X had run-ins with actual Communists and attended some college lectures and decided the first was pure evil and the latter was a waste of tax money
Malcolm X actually has a pretty well known Autobiography published many decades ago. If anything he was a Black Nationalist and while be became more mild in his final years, at best he could be considered an advocate of Black Self Determination/Reliance and internationally a form of Pan-Africanism. He had a loathing of White Liberals because they were condescending and duplicitous and actually had a story from his childhood where a teacher talked with him about his future and despite his good grades, the Teacher said that his dream of studying law was unrealistic because he was a nigger and he should think of becoming a tradesman like a welder or plumber or something. He looked back on that encounter with the White Teacher and stated he was glad that the Teacher squashed his academic aspirations because if he was encouraged by the Teacher, he would end up one of those Black liberal intellectuals sitting around conference tables talking about the detached plight of Black people and how they can persuade White people to treat them as humans.
And yes, there is the fox and wolf parable as well in regards to Liberals and Conservatives that Malcolm X had as well.
In regards to Communism, he was pretty ambivalent. He said he'd support Socialism if it supported Black People but also called himself a Communist, but that was mostly to troll White people it seemed. He was against the Korean and Vietnam Wars and reacted to China developing its own nuclear weapons positively.