Cells And Muscles
Even after a fish dies, some cells in the body can still react to stimuli. In this case, it was sodium.
The scientific answer had a lot of complicated ideas about sodium and potassium ions reacting to neurons firing as well as electrical signals. This chain reaction can cause muscles to contract and release for a short period of time.