Mexican Jumping Beans are not really beans
They are the Seed Pods of a Small Moth Larva
Mexican jumping beans are not actually beans but the seed pods of a small moth larva known as Laspeyresia saltitans. These larvae inhabit the seed pods of certain shrubs native to Mexico, such as Sebastiania pavoniana. The "jumping" motion of the bean is caused by the larva's movement inside the pod. Here's how it works:
Inside the seed pod, the larva of Laspeyresia saltitans moves its body in response to changes in temperature. This movement causes the bean to "jump" or twitch.
The larva is sensitive to heat, and when warmed (such as by the heat of a person's hand), it becomes more active. This activity leads to the jerky movements that give the impression of the bean jumping.
The larvae of Laspeyresia saltitans eventually mature into small moths. The "jumping" behavior of the bean helps the larvae move within the pod and potentially relocate to find more favorable conditions for their development.