I presume it's from either a Jewish or an Islamic background, where pigs are seen as filth. A criminal doesn't want to see himself as being on the bad group, so he will think of nasty names for the other side. The names that sound bad but can be used without immediately being locked up will stay, and gain in popularity. Once a journalist picks up the name and uses it in a story about criminals it takes on a life of its own.
Edit: If it was used for others before that it may originate from the same source, but have been picked as 'just another bad name' for cops later on.