probably from Old English *picg, found in compounds, further etymology unknown. Originally "young pig" (the word for adults was swine). Apparently related to Low German bigge, Dutch big ("but the phonology is difficult" -- OED). The meaning "oblong piece of metal" is first attested 1580s, on the notion of "large mass." Applied to persons, usually in contempt, since 1540s; the derogatory slang meaning "police officer" has been in underworld slang at least since 1811.
The pigs frisked my panney, and nailed my screws; the officers searched my house, and seized my picklock keys. ["Dictionary of Buckish Slang, University Wit and Pickpocket Eloquence," London, 1811]Another Old English word for "pig" was fearh, related to furh "furrow," from PIE *perk- "dig, furrow" (source also of Latin porc-us "pig," see pork). "This reflects a widespread IE tendency to name animals from typical attributes or activities" [Lass]. Synonyms grunter, porker are from sailors' and fishermen's euphemistic avoidance of uttering the word pig at sea, a superstition perhaps based on the fate of the Gadarene swine, who drowned. The image of a pig in a poke is attested from 1520s (see poke (n.1)). Flying pigs as a type of something unreal is from 1610s.
1670s, "to huddle together," from pig (n.). Related: Pigged; pigging. To pig out "eat voraciously" attested by 1979.