You are not required to attack planeswalkers before the player.
When you attack, you may attack either the player or any planeswalker they control. The rules on declaring attackers quite simply state you choose attackers, then you choose which player or planeswalker each one is attacking:
508.1 First, the active player declares attackers. [...]
508.1a The active player chooses which creatures that they control, if any, will attack. The chosen creatures must be untapped, and each one must either have haste or have been controlled by the active player continuously since the turn began.
508.1b If the defending player controls any planeswalkers, or the game allows the active player to attack multiple other players, the active player announces which player or planeswalker each of the chosen creatures is attacking.
So, totally up to you whether you want to attack the player, one of their planeswalkers, or a combination.
If I had to guess, you've heard people share strategy advice that you should attack planeswalkers before the player so as to prevent the player from activating that planeswalker's ultimate ability—ultimates often turn the tide of the game permanently for whoever activates them. Some of them might've even put it as strongly as "you must attack planeswalkers first!" — but that's advice, not a game rule. Attacking the player remains a valid option; after all, a player who's hit 0 life and lost the game can't activate an ultimate either. :)
If not, what happens to the planeswalker if I lose all my hp? I've heard a few different things about this as well.
If you hit 0 life you've lost the game. The game is over, or if it's multiplayer, all cards you own leave the game entirely. So what happens is your planeswalker card is out of the game at that point.
Assuming you have something like Platinum Angel out which prevents you from losing the game for having 0 life, then nothing happens. You've just hit 0 (or negative) life. You continue play because you haven't lost. You still have out whatever you had out before you hit 0 life, and none of it has changed, just the same as nothing would change from you dropping from 10 to 5 life.
Your life total and your planeswalkers' loyalty are wholly unrelated things and do not interact.