A voyeur. A man who furtively observes naked or sexually active people for his own gratification.
The name comes from the legend of Lady Godiva's naked ride through the streets of Coventry, in order to persuade her husband to alleviate the harsh taxes on the town's poor. The story goes that the townsfolk agreed not to observe Godiva as she passed by, but that Peeping Tom broke that trust and spied on her.
The ride is still commemorated (clothed) in the city each year. As the picture shows, there's no longer any taboo about watching it.
Gleaning the elements of fact from this story isn't straightforward. Lady Godiva was an actual historical figure and is mentioned in various ancient records, including the Domesday survey of 1085. There's some justification to regard her as a patron of the town, although some accounts dispute this. She married Leofric in 1040 and in 1043 she persuaded him to build a Benedictine monastery at Coventry.
This is a translation from a Latin text, written a century or so after the supposed event - the Flores Historiarum, by Roger of Wendover, who died in 1236.
"Ascend," he said, "thy horse naked and pass thus through the city from one end to the other in sight of the people and on thy return thou shalt obtain thy request." Upon which she returned: "And should I be willing to do this, wilt thou give me leave?" "I will," he responded. Then the Countess Godiva, beloved of God, ascended her horse, naked, loosing her long hair which clothed her entire body except her snow white legs, and having performed the journey, seen by none, returned with joy to her husband who, regarding it as a miracle, thereupon granted Coventry a Charter, confirming it with his seal.
Whatever the truth of the ride through the town, there are no accounts of this story which mentioned a 'Peeping Tom' character until the 18th century and that has to been seen as a later invention. Why that embellishment was given to the story isn't clear.
The name 'Peeping Tom' is first recorded in the Coventry city accounts in 1773, recording a new wig and paint for the effigy of Tom the Tailor (which clearly must have existed for some time prior to that).
The first record that alludes to his dubious habits is in Grose's Classical Dictionary of the Vulgar Tongue, 1796:
"Peeping Tom, a nick name for a curious prying fellow."
Peeping Toms aren't of course restricted to mediaeval times. Towards the end of the 20th century they got a new activity to partake in, or at least a new name was given to an old activity. The term dogging was coined in the UK - meaning 'spying on couples having sex in a car or some other public place'. The meaning of dogging has since modified somewhat to include the practices of engaging in or viewing in sex in public.