There are several theories about where the slang came from;
copper- because of the color/style of button on NYPD uniforms in the 1800's
cop- an acronym for Constable on Patrol
I'm sure there are others. The word "cop" in and of itself isn't necessarily derogative. In fact it is used affectionately amongst law enforcement personnel. That being said, it can be used as a sneer towards police.
Just like the word Jew is an official and appropriate word to call someone of the Jewish faith, it can be said in a biting and sneering manner as an insult.
Its all how you say it and what you mean by it. Personally I have been called MUCH worse on the street...