HP stands for hit points. It is the amount of health your Pokémon has. Each attack it takes will take away some hit points, and when it reaches 1 or 0 (1 for friendly gyms, 0 for enemy gyms) it will be defeated. So the more hit points your Pokémon has, the more damage it can take in a fight before being defeated.
Well your Pokemon has HP in battle too. The higher it’s HP the more hits it can take, both in training and attacking/defending a gym from an opposing team.