One bad apple spoils the whole barrel.
Adages and idioms are odd things. A saying can take on a life of its own and come to mean the opposite of what it says.
An over-ripe apple emits a musky gas called ethylene as it starts to rot. Other apples nearby absorb the ethylene, which speeds their ripening. They in turn give off ethylene as they spoil. The rot spreads.
Curiously, these days to blame a few bad apples for prisoner abuse or police violence or business corruption is to affirm the innocence of everyone else. Of course the proverb says just the opposite: Let a little rot slip through unhindered, and soon the whole bunch will be rotten to the core.
I'm a historian who writes novels and literary nonfiction. My home base is Madison, Wisconsin.