The key is the frog legs must be fresh and skinned. The cells in the frog are still intact and the biochemical machinery still works.
The cells contain unused ATP which is a coenzyme found in all organisms and used as an energy carrier.
The muscle only needs an activator to release the ATP stored in the cells to make them contract or relax.
There is a limited amount of ATP stored in the cells, mind you, so the movement will end.
Galvani was the first scientist to show that electricity could activate frog legs and since salt contains sodium ions, it can create voltage differences, much like electricity.