This sentence is an example of reported speech. Ross is reporting something that he thought before he came to the party. You might imagine Ross saying to himself on his way to see Rachel "I want to wish her a happy birthday before I leave". Notice that his thought to himself is in present simple tense. When he goes to report this thought to his sister Monica, he must use reported speech in which tenses are moved back in time: present simple becomes past simple, past simple becomes past perfect, etc. It is due to this that both want and leave are expressed in the past simple.
Using reported speech instead of directly saying "I want to wish her a happy birthday before I leave" shows us merely that it was a thought or a conversation that has already happened. In this case it indicates premeditation. Ross is not spontaneous :)