The chemistry rating is affected by:
Only your forward lines and defense pairings affect team chemistry. Powerplay lines, penalty kill lines and goalies have no bearing on your team's chemistry rating. Playing the same players on the same line game after game does not affect chemistry, either.
Here are the best player type combinations for forwards:
(Left Wing -- Center -- Right Wing)
Unfortunately, there does not appear to be a use for the "tough guy" player type in NHL 12 Ultimate Team, as he brings the chemistry rating down in most line combinations.
For your defensemen, here are the two best ways to achieve maximum chemistry:
(Left Defender -- Right Defender)
Pairing Up Teammates And Leaguemates
Having a line with players from the same team or the same league provides an additional boost to chemistry.
If you can't match same-team or same-league lines, the next best thing is having players from the same region. For example, a North American line with a mix of AHL and NHL players will perform better than a mix of AHL and DEL players, as the DEL is a German league.
Here are the most-effective pairings, listed from those that give the most chemistry to those that create the least chemistry:
Each card in your collection has a natural position where the player performs best. For instance, a natural center trying to play as a winger will not perform as effectively in that role.
For maximum chemistry, each player on your line should be in his favored position.
If you want to change a player's position, simply go to the online auction house and do a search for "position change" cards. These typically go for around 500 pucks, so finding a good deal should be easy if there's a player you want to move to a new position.



Madden NFL 12: Best Position Switches
An Idiots Guide to Soccer and Soccer Gaming (Part III)
PES and FIFA Formations Guide
NHL 10: Scoring Strategies
The Basics of Reading a Defense in Madden NFL 12