"city ruffian, one of a gang who assaulted people and property in mid-19th century American cities," 1856, originally in Baltimore, from plug (n.), the American English slang name for the tall, silk stovepipe hats then popular among young men, + ugly. Sometimes as the name of a specific gang, but often generic.