Its called conservation of energy. A wind up toy consists of a spring which is attached to a winder. When the winder is rotated the energy used to rotate the winder is stored in the spring in the form of potential energy. After releasing the winder the spring tries to unfold and the stored potential energy is converted into kinetic energy which is then transferred to the gears attached to the spring.