The term beans can be used as a slang word word for testicles, as they often resemble a pair of large legumes.
In mammals, the "beans" are usually located outside of the main torso. This is to aid in temperature control as core body temp is too warm for successful creation of viable sperm.
It is better for the reproductive chances of mammals for their "beans" to remain cool.
Hence, "cool beans" came to mean "good", or that all is well. Its use then grew, and it is now often used to indicate hearty approval
You got a PS5 for Christmas? Cool beans!