In The Dark Knight, it is mentioned that the cops had a nick name for Harvey Dent even before the accident in which half of his face got burnt. Why did they call him that?
In the scene where Gordon stands at Harvey's bed in the hospital (which is also where his nickname is first mentioned) it is said that Harvey was working for the Internal Affairs Department, which is in itself not that popular with the cops. So I understood this along the lines of Harvey showing two faces to the people/cops, the nice and charismatic friend and the hardened investigator without mercy. Add to this that they might also have known about his habit of "making his own luck" by employing a coin with two faces. This could also have contributed a little to that name (provided people knew it was a two-faced coin), even if the major reason was probably more his character than this little playful habit. So much to the likely in-universe explanation of this matter.
There is however an even more significant and deeper aspect to this. The fact that he was called "Two-Face" even before the accident can also be seen as an allusion to the idea that this dark persona has always been present in him. At first it seems an obvious explanation that his personality as Two-Face was caused solely by a combination of the physical and psychological trauma he experienced during the whole Rachel event and the surrounding circumstances. But the truth is, his physical distortion is not the cause for his psychological one, it is merely an incarnation thereof. This dark side has always been part of Harvey Dent. In his book Batman and Psychology: A Dark and Stormy Knight Travis Langley also makes a short mention of Harvey's case in The Dark Knight specifically (and his difference to Bruce, who afterall shared a similar trauma), reinforcing this notion:
And in fact at various points throughout Batman lore it has repeatedly been shown that it is not his disfigurement that makes Two-Face who he is and it is not done with healing him physically and the mind will just automatically follow. Take, for example, his depiction in Frank Miller's The Dark Knight Returns, where a psychiatrist and a surgeon try to heal both Harvey's mind and his body in unison. And they both think they were successful (as does Bruce Wayne). But it turns out Two-Face's inherent character cannot be changed and even if he looks like Harvey Dent again, he'll always be Two-Face. Then there's also his origin story in Batman: The Animated Series where it shows that the evil side of Harvey has always slept within him, supressed from his childhood days, and his physical trauma was merely a facilitator in letting it break through completely. And last but not least, we have Jeph Loeb's The Long Halloween, which was a major inspiration for The Dark Knight. There Harvey also shows in his dialogue that he is the most progressive and reactionary of the three crime fighters and it is hinted (even if ultimately left open) that he might have commited some of the Holiday Murders himself even before his transformation.
So on the bottom line, the deeper reason, if less of a direct explanation, why he was called "Two-Face" even before his accident is because that's who he truely is and has always been underneath.