Middle English pigge "a young pig" (mid-13c., late 12c. as a surname), probably from Old English *picg, found in compounds, but, like dog, its further etymology unknown. The older general word for adults was swine, if female, sow, if male, boar. Apparently related to Low German bigge, Dutch big ("but the phonology is difficult" -- OED).
By early 14c. pig was used of a swine or hog regardless of age or sex. Applied to persons, usually in contempt, since 1540s; the derogatory 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 the animal was fearh, which is related to furh "furrow," from PIE *perk- "dig, furrow" (source also of Latin porcus "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 late 14c. (see poke (n.1)). Flying pigs as a type of something unreal is from 1610s.
mid-15c., piggen, of sows, "to farrow, to bring forth piglets," from pig (n.1). By 1670s as "to huddle together in a dirty or disorderly manner, as pigs do, hence, generally, "to act or live like a pig" in any sense. Related: Pigged; pigging. Colloquial pig out "eat voraciously" is attested by 1979.
"oblong piece of metal," 1580s, from pig (n.1) on the notion of "large mass." In Middle English sow also was used of a mass or bar of lead (mid-15c.).