I swear I am not making this up

Ok, so a castrated male horse (and perhaps other animals, I don't know) tend to not exercise their penises very often. The penis is kept in a pouch like thing called a sheath, where it is safely out of harms way and hidden inside the stomach cavity. Now, when it sits there for a while, sweat and dirt tend to build up and since the non sexually active male horse doesn't air out his manhood much, this tends to be a problem. If you don't clean the sheath out regularly, the crud forms little balls (no pun intended) inside the sheath which after some time and movement form hard little pellets that get rather firmly attatched.

And, coming to the point, these hard little deposits of crud are known as beans.

And now you know...