Ellos habían trabajado juntos por intereses comunes.

English Translation

They had been working together for common interests.

Why is this “por” instead of “para”? Thanks!

I’d say that “para” is for the goal and “por” for the motivation. But here para would be a bit strange; to keep the sentence you’d have add something like “lograr”. So:
Ellos habían trabajado juntos por intereses comunes. → They had worked together because of their common interests
Ellos habían trabajado juntos para (lograr) intereses comunes. → They had worked together to achieve their common interests.

But you could use para in a sentence like this one:
Ellos habían trabajado juntos para ganar → They had worked together to win