So the key to that is making sure your goals align with the party's.

The second key is to give your character the assumption that the party is strong and getting stronger, and it's better to have them as allies than enemies.

"My character would <do thing against party goals>. But... that would anger the party. While doing that thing is likely more efficient or helps my goals short term, in the long term it probably makes more sense to have the party working with me." This especially works if everyone's goals are compatible.

Remember always that class IS NOT personality. Alignment is not a personality disorder. People are more flexible than they often think.

For personality, think of a few big drives of instincts, and play them up - but make sure they are not incompatible with the party. (Drive = thing you want to accomplish, Instinct = the way you normally think about solving problems.)