The
converse of an anti-hero (i.e., a protagonist who isn't purely good or heroic), an anti-villain is an antagonist who isn't purely
evil nor entirely unsympathetic -- a
character who doesn't seem to deserve being cast as the villain, perhaps cast arbitrarily as the villain because they are not the focus of the story but merely present a foil to the central figure, who may be an antihero protagonist. Cf. scapegoat.
Magneto was an antivillain because, while the X-Men were the protagonists who fought to defeat him and prevailed in
the end, we can still respect and appreciate him for his motives and principles, however
ill-considered his ruthless methods.