Old English bean "bean, pea, legume," from Proto-Germanic *bauno (cf. Old Norse baun, Middle Dutch bone, Dutch boon, Old High German bona, German Bohne), perhaps from a PIE reduplicated base *bha-bha- and related to Latin faba "bean."
As a metaphor for "something of small value" it is attested from c.1300. Meaning "head" is U.S. baseball slang c.1905 (in bean-ball "a pitch thrown at the head"); thus slang verb bean meaning "to hit on the head," attested from 1910.
The notion of lucky or magic beans in English folklore is from the exotic beans or large seeds that wash up occasionally in Cornwall and western Scotland, carried from the Caribbean or South America by the Gulf Stream. They were cherished, believed to ward off the evil eye and aid in childbirth.
Slang bean-counter "accountant" recorded by 1971. To not know beans (American English, 1933) is perhaps from the "of little worth" sense, but may have a connection to colloquial expression recorded around Somerset, to know how many beans make five "be a clever fellow."
[first sense fr the belief that a bean-fed horse is particularly frisky and strong; second sense fr a connection with beans, hops, prunes, etc, as promoting excretion]
Something regarded as the most important element: the be-all and end-all of series finales
[1605; fr Shakespeare's Macbeth, ''That but this blow Might be the be all, and the end all.'']