I just had to say this, as a black man and X-Men comic fan, because I always see people making the comparison, including the actors Michael Fassbender and Ian McKellen. And although they can play great Magnetos, are not right on this issue.
As someone who has read a lot of X-Men involving Magneto, there are such stark differences:
- Magneto has shown time and again that he is perfectly willing to kill fellow mutants if they get in the way of his fanatical and violent vision of his crusade against humanity, which can most notably be seen in X-Men: Eve of Destruction, when he ordered the Neo mutants to kneel before him and join in his anti-human war, and literally ripping two of them apart when they refused. The fact that he ordered the mutants to kneel before him also shows a narcissistic side as well. Malcolm X would never kill fellow blacks for disagreeing with his methods; did you ever see the man ordering his followers in the Nation of Islam to do such a thing either? No.
- Malcolm X never expressed a desire to commit wanton and unprovoked acts of violence against white people wholesale; he only called for blacks to defend themselves. On the other hand, many times, Magneto has expressed a desire to, and at actually tried to, kill all humans or a vast majority of them. As leader of Genosha, he frequently rabble-roused against the humans to his mutant flock in Genosha, and was damn near about to go to war against them, and kill thousands, maybe even millions of them, if he had not been stopped by the X-Men.
- In Fatal Attractions, Magneto used his powers to unleash a devastating EMP on the entire planet, causing electricity to malfunction all over, killing countless thousands in hospitals, planes, cars and other vehicles, etc. Why? As retaliation for the Magneto Protocals activation by the UN, which prevented him from using his powers within the Earth. Malcolm X would never kill untold innocents just to make a point. The ironic thing is that some of Magneto's fellow Holocaust survivors and mutants could very well have been killed in the pandemonium.
And, honestly, a good number of the mutants are not a good metaphor for oppressed minorities in today's culture, if they ever were. For example, think of Professor X and Emma White. They are both of them privileged, white and wealthy, have absolute control of their telepathic powers, can use them freely with absolutely no physical or mental detriment to their bodies, and their powers have a very positive effect on their lives.
Are we supposed to feel sorry for them, and compare their situation to those of us who are black and worry about racial profiling, discrimination in employment, and being shot by trigger-happy police officers? Of course not.
I remember one story when Emma chided Beast for considering taking the mutant cure. It was easy for her to do, as a rich white woman whose powers are nothing but an immense benefit to her life, do nothing to impede her physical beauty, or her mental state. But for a mutant like Beast, who, although a brilliant scientist, is an average-income guy from Illinois who was turned into an agile catperson who is blue, and has had more and more trouble controlling his instincts. Mutants like him are a good analogy for minorities, as they have to risk being hated just for the way they look.
As for Professor X, among other things, he has repeatedly trained teenagers in his Danger Room to be a part of a paramilitary mutant group able to use their powers in lethal ways if need be. Could you imagine MLK, a dedicated pacifist and staunch opponent of the Vietnam War, training black teenagers to use pistols, shotguns and rifles against white racists? Again, no. While Professor X has a legitimate purpose in ensuring powerful, Omega-level type mutants can control their powers and make it so they don't accidentally go off randomly and hurt civilians, that is different from sending them out in dangerous, life-threatening situations to fight battles.
These are just my two cents.