I don't think Master Xehanort is evil, at all. I think he's just trying to balance the darkness and light.
Think about it.
Master Xehanort's heart is full of darkness.
Terra's heart is full of darkness.
Master Eraqus heart is full of light.
Aqua's heart is full of light.
All he wants to do is fill some darkness in Ven's heart to make a balance. I have a feeling he made Vanitas do the job, but he over did it and tried to overflow his heart with darkness which made an imbalance. Master Xehanort then kidnaps Ven and places him in the Chamber of Awakening because his heart was imbalanced. Terra doesn't give two shits of what Master Xehanort wanted, but because he kidnapped Ven, he wants to avenge Ven and fights Master Xehanort.
Master Xehanort wants balance, but I think Vanitas is the true villain. Master Xehanort is probably mislead like the members of the Organization XIII. People may seem he is evil, but he's accomplishing his goal in a wrong way.
I think Master Eraqus and Vanitas fought and Vanitas may have won, and even killed him which fucked things up even more with the balance, and then Master Xehanort probably went to Terra and asked him to destroy Vanitas once and for all.
What's Vanitas heart you may ask? Nothing. Though he possessed the power of darkness, he may have been a creation. A puppet who has no heart.