The story
Possibly from jolly + Roger (“dialectal nickname for the Devil”).
First known use, by meaning
- from early 18th c. The traditional flag used on European and American pirate ships, and, more recently, by submarine crews, often pictured as a white skull and crossbones on a black field; the blackjack.
Etymology from Wiktionary, CC BY-SA 4.0.