Supposedly "cool beans" was a 1960's variant of the later 1800's phrase "some beans," which was a way of saying something was impressive or full of vigor (e.g. "You see that boy in that fight? He's some beans!"). Further, but less reliable, probing indicates that phrase was itself adapted from horse racing terminology in which you'd claim a fast horse was "full of beans." Which might have been a joke about horses running fast because they were propelled by farts.