When Ventus proved too resistant to the Darkness, Xehanort used his Keyblade to draw out what darkness there was within Ventus's heart, which left Ventus with a heart of pure light and created his dark reflection, Vanitas. Xehanort had planned to create a clash between these two to forge the χ-blade, but the trauma of having his heart violated left Ventus in a comatose state, and so Xenahort entrusted Ventus to his old friend, Eraqus, while Xehanort focused on training Vanitas. Under Eraqus's training, alongside his other students, Ventus recovered and began to discover his potential. Through a series of further machinations, Xehanort eventually got his clash between Ventus and Vanitas, but Ventus's friends thwarted him.
In the conflict with Terra, one of Ventus's closest friends, Xenahort was able to possess Terra, but he was transported elsewhere. Now inhabiting a young, strong body, Xehanort became the apprentice of a wise scholar, eventually usurping the man's identity and corrupting his students to transform them into Nobodies and create Organization XIII. Through the Organization, Xehanort sought to complete the work he had begun so long before, but in the end he was thwarted by the Guardians of Light. Terra was restored, his spirit having resisted Xehanort the whole time, and in his final moments, it seemed that Xehanort finally let go of his dark ambitions to ascend into a spiritual existence.
Whether that is the truth remains to be seen.