As a system of voting, the ancient Greeks placed beans in a jar.
They called these small beans or balls “ballota,” which gives us the word ballot.
A white bean was a “yes” and a brown bean was a “no.”
The beans were then counted in secret so the candidates wouldn’t know who voted for or against them.
If the container was knocked over, and the beans were spilled, the secret was out of the jar.
When someone leaks a secret we say he’s “spilled the beans”, or let the cat out of the bag.