Not every "villain" is playing the hero. The X-Men are composed of all kinds of characters, many of whom have dark histories and unsavory pasts. No X-Man is a pure angel. Xavier was always creepy, predatory, secretive, manipulative, and definitely not 100% a hero. The X-Men are not dualistic. The characters aren't two-dimensional. The concept isn't binary. There is no way to divide the characters into "heroes" and "villains" just like in real-life. The characters range on a continuum. Some worse than others, some more purely heroic than others.