In 1811, the word, 'pig' was mentioned by the Oxford Dictionary as the name of the earliest police force headquarters. This was before the era of Sir Robert Peel and before the Metropolitan Police came into existence. Before this time, people used the term pig around the middle 50s to describe an extremely disliked person in 20 century. The usage, however, was reserved for criminals until the 60s when protestors adopted it. If you have always believed the term pig came into use in the 60s, you are quite wrong.
The masks used by the police in that era when they threw tear gas coupled with the character in the Animal Farm by George Orwell lent some false explanations to the origin of the use of the term pig.
As for the cops, it is most likely the cop used as a noun was derived from the copper. The first use for the name copper as a slang for policemen was in 1846. One most likely explanation is, it was derived from the verb to cop, which means to seize, snatch or capture which was first used in 1704. Like most other words, there are several false theories surrounding its origin. Pay no attention to the claim that the word cop for the police means Constables On Patrol. It is also false that the use of the word began with the copper buttons and badges on New York Police uniforms. People have called the police several names like coppers, fuzz, pigs, etc.