1861, originally of ships and locomotives, from head (n.) + light (n.). Related: Headlights, which, as slang for "a woman's breasts," is from 1940s.