The fight is less about X1 himself and more about clearing the room before you get to him.
Eliminate all the stormtroopers first, then enter the chamber where X1 waits. In the final level, he goes down to your lightsaber — so once the adds are gone, close the distance and finish it in melee.
Trying to fight him while troopers are still active is the usual reason the attempt falls apart.