There are three reasons for fighting in hockey and the first reason is for a way for players to police themselves. When a shit disturber is slashing, late hits or taking cheap shots at a star player and the ref doesn't see it or won't blow the whistle, the star player's teammate came come in and initiate a fight to keep the shithead in check.
The league is trying to stop this, because now they have a instigating rule, where if you start the fight, you get an extra two minutes in the box. Which is stupid, because now there are lot more cheap shots happening by smaller players and they refuse to fight, because they know they'll be killed, but they know that rule will protect them and their coach will be glad that they instigated the other team to get an instigating penalty.
The second reason is psychological. When your team is down by the score, and you're getting out shot, out hit, out hustle, and just plain losing; you need a spark to give your team some energy. So you start a fight and if you win it, it's a moral boost to your team. They get jacked up.
The last reason is just pure revenge from a past incident.