During the events of Mega Man X, Vile's core was completely destroyed. However, Dr. Cain speculated that his armor could hold the secret to his behaviour. He wasn't a Maverick necessarily. He did his own thing, having only allied with Sigma because of the power hierarchy at hand. His parts were quickly sent to hidden research labs.
Six months later when X became the Maverick Hunters leader, X sets out to challenge the new rebellion, exploring technological and isolated facilities to protect humanity. While in his quest, he stumbles upon capsules remote controlled by Wire Sponge. After through inspection, he realizes that's where Vile's parts were being stored.
But after X accidentally activated one of those devices, Vile's armor mixed with his own. Slowly but surely, his thinking process wasn't the only one present anymore. He would share his consciousness with none else other than Vile's afterthoughts. Deciding to continue Sigma's pursuit, he would continuously push Vile's ideas aside.
The Loose Cannon insisted in tempting X, and to his own surprise, he thought it sounded less and less crazy. Every now and then, they started to agree on some points. Running into more of his invasive counterpart's purple armor, he promptly equipped them when he realized that was when Vile started to fade away.
It's not like he agreed with what Sigma was doing, so he eventually challenged and defeated him. Afterall, he needed time to organize his thoughts and carry out his own plans. He never became quite like Vile, but he wasn't just the X everyone knew anymore.
When he was finally ready to put his plans into motion, Zero showed up. To be continued...