"plainclothes detective," 1906, from the rubber-soled shoes they wore (allowing stealthy movement), which were so called from 1863 (

gums

"rubber shoes" is attested by 1859); from

gum

(n.1) +

shoe

(n.).