Gel electrophoresis and foam
Gas bubbles are foamed by electrolysis of water, generating bubbles of hydrogen gas on the negative electrode and oxygen gas on the positive electrode. 

As for the foam itself... I am guessing there is some form of detergent in the buffer. Some electrophoresis buffers do contain detergent.