We mostly hear the expression "to know beans" used in a negative terms as in, "you don't know beans about...."
One word authority suggests the expression is a reference to the city of Boston: "the home of the bean and the cod," the city of culture and learning, and where, according to some, it would have been a mark of sheer ignorance not to know that Boston baked beans are made from navy or pea beans.
Other sources say the expression may have been derived earlier from the British phrase, "to know how many beans make five."
This saying referred to teaching children how to count. When a child could count out five beans, he was considered intelligent, which is just what the phrase "to know beans" implies.
This expression, akin to letting the cat out of the bag, came into use about 100 years ago. According to word authority Charles Funk, it very likely arose from an incident involving baked beans that were presented as the main dish.
Just before serving the meal, the steaming pot may have been dropped, Funk says, causing not only a hot, goopy mess, but also a prompt change in menu.
Today spilling the beans, or causing a near catastrophe, takes on the added sense of telling a secret. It also may have evolved from another beany expression - perhaps even from the previously noted phrase, "to know beans."
SOURCES: 'Hog on Ice' by Charles Funk; 'The Encyclopedia of Word and Phrase Origins' by Robert Hendrickson.