The Kings will say this trade was done to "shake up the team" and to "add speed" to the roster. Which are technically true, but the real reason for the trade (i believe) is that Hagelin is a UFA at the end of the year where Pearson is on the books for another 2 years after this.
It basically opens up money come July.
It makes sense for both teams. Kings get out of one of their several long term deals which opens space from the cap as well as future openings for the Kings prospects. And Pens get a little younger, a little cheaper (after this year) and little more snarl to play along side any of Crosby, Malkin, Brassard, or Sheahan.