
Short answer The barcode came from Morse code drawn in sand, and the first thing scanned was gum.
That beep at the checkout. The barcode is older than you'd think.
Norman Joseph Woodland, an American, got the idea while drawing Morse code in the sand at the beach.
Stretch the dots and dashes of Morse code straight down and you get thin bars and thick bars.
1952the year the barcode patent was granted
But there was no machine to read it. It took more than 20 years to reach real stores.

June 26, 1974, a supermarket in Ohio, USA. The first item ever rung up with a barcode was a 10-pack of Wrigley's Juicy Fruit gum.
The historic first customer was gum?
A replica of that gum pack went on display at the Smithsonian museum in the US.
Numbers are hidden in the width and spacing of the bars. The machine uses those numbers to look up the product.
Sources
Photo credits
- Upc reader.jpg, Michael Shanks, Public domain (source)
- Juicy Fruit.jpg, Alexander Staubo from Oslo, Norway, CC BY-SA 2.0 (source)
More useless facts
FoodKetchup Used to Be Fish SauceThe word ketchup came from a name for pickled fish brine
The BodyMorning You Is Taller Than Evening YouYou'll measure tallest if you do it in the morning
PsychologyYour Dog Can Catch Your YawnsWhen you yawn, your dog might yawn right along with you
AnimalsKoala Fingerprints Can Pass for Human OnesEven under an electron microscope, koala and human fingerprints are hard to tell apart