Presumably because he entered the game as a PH, not as an RP. Though the rules don't expressly forbid this, they don't exactly endorse it either. It is weird.
Gagne was credited w/ the win because he was the pitcher of record when the winning run scored.