Moran is someone from John's past, and the closest thing he might have to his own archenemy. He teams up with Moriarty in order to get his own revenge on John, who had only hoped Sherlock wouldn't never find out about that very dark part of his history.
You're not the only one with enemies, Sherlock.