1620s, originally a seamen's term, probably from Dutch plug, Middle Dutch plugge "bung, stopper," related to Norwegian plugg, Danish pløg, North Frisian plaak, Middle Low German pluck, German Pflock; of uncertain etymology. Irish and Gaelic words are from English. Sense of "wad or stick of tobacco" is attested from 1728, based on resemblance. Electrical sense is from 1883, based on being inserted; meaning "sparking device in an internal combustion engine" is from 1886. Meaning "advertisement" first recorded 1902, American English, perhaps from verb sense "work energetically at" (c. 1865).
"close tightly (a hole), fill," 1620s, from plug (n.) or from Dutch pluggen. Meaning "work energetically at" is c. 1865. Sense of "popularize by repetition" is from 1906. Slang sense "put a bullet into" is recorded from 1870. Related: Plugged; plugging.