Why does an electrical shock freeze up muscles?
Interesting question!

An important factor here is the let-go phenomenon, which is defined as the current level in the arm that will cause the hand to involuntarily grip the current source. When the fingers are wrapped around a large cable, most adults will be able to let go with a current of less than 6 mA. At 22 mA, however, more than 99% of adults will not be able to let go. 

Nearly all cases of inability to let go involve alternating current. Alternating current repetitively stimulates nerves and muscles, resulting in a tetanic (sustained) contraction that lasts as long as the contact is continued. If this leads to the subject tightening his or her grip on a conductor, the result is continued electric current flow through the person and lowered contact resistance.

Given that the current flow in the forearm stimulates both the muscles of flexion and extension, it seems surprising that one cannot let go. However, the muscles of flexion are stronger, making the person unable to voluntarily let go (similar to the fact that a crocodile's jaws can be kept shut with your bare hands, but one should better not attempt to keep them open like that...). 

Direct currents below 300 mA have no let-go phenomenon, because the hand is not involuntarily clamped.

Several different outcomes may occur when a person grasps a conductor giving 10 kV AC hand-to-hand voltage. Within 10 to 100 milliseconds, muscles in the current path will strongly contract. The person may grasp the conductor more tightly. However, mostly subjects are propelled away from the contact, likely due to generalized muscle contractions. 

Reference
- Fish &amp; Geddes, J Plastic Surg (2009); 9: 407-21