The short answer: you defeat Darth Malak.
Of course, getting there is the game. Knights of the Old Republic is a sprawling RPG in which the final confrontation is the last step of a long journey — you build your character, gather companions, travel across several worlds, and uncover the twist about your own identity before Malak is finally within reach.
So while "kill Darth Malak" is technically the win condition, the real content is everything you do to earn that fight.