Beans, like straw, have long indicated small value. “Not to care a straw” means that the speaker has little more than the slightest concern over that of which he speaks, no more than the value of the straw trampled upon by householders of old. And the bean has long had no higher regard. (“Hill” is American hyperbole, inserted about a hundred years ago for exaggerated emphasis.) The expression is one of the oldest in the language. We find it used by Robert of Gloucester back in 1297 in his English Chronicles, page 497:
pe king of alimayne sende specialliche inou To king Ion pat he wipdrowe him of is wou & vnderuenge pe erchebissop & holichurche al clene Lete abbe it franchise & al nas wurp a bene.
We don’t speak or write that way now, thank heavens, but freely translated it reads: “The king of Almain (Germany) sent (a message) especially to king John to forget his hurt, and receive the archbishop, and let Holy Church have her franchise, clear and clean; altogether not worth a bean.”