How is XP calculated for a hero's level after a match?

That screenshot seems to be from pre-2.0 Heroes of the Storm. Since 2.0 hit, there is no separate player XP bar.

Anyway, there are a few things that determine how much XP you get per match:

  • Whether you won or lost
  • The amount of in-game XP your team got (killing enemy heroes, minions, and buildings)
  • Bonus XP (applied on top of the base XP as calculated from the two above)
    • First win of the day gives +50% bonus. Doesn't apply in Training mode, Custom Games, or the weekly Brawl.
    • Hero League gives +25% bonus.
    • Team League gives +50% bonus.
    • Stimpacks gives +100% bonus.
    • Playing with one or more friends gives +25% bonus.
    • Party size provides a bonus based on how many people are in the party. +25% bonus for 2 people, +33% bonus for 3 people, +42% bonus for 4 people, and +50% bonus for 5 people.

All those percentage bonuses don't stack, which means that they are applied separately to the base XP of the game (without the win bonus).

The higher level your hero, the more XP it takes to earn a new level. Each level you gain gives you one (or more) lootbox(es). This lootbox will be an Epic lootbox if your player level if a multiple of 25, a Rare lootbox if your player level is a multiple of 5 (but not multiple of 25), or a Common lootbox for every level not mentioned above.

You also get a hero-specific lootbox if your hero's level is a multiple of 10.