Nothing happens to the gel.
The proteins simply move through the channels in the gel.
The dye is chosen to run off before any of the proteins. That's how you know when to stop the electrophoresis.
SDS-PAGE stands for
SDS-PAGE is used to separate proteins according to their size (molecular mass).
We first denature the proteins so they no longer have any secondary, tertiary or quaternary structure.
For this we use a detergent like SDS (sodium dodecyl sulfate, C₁₂H₂₅OSO₂O⁻, Na⁺).
The SDS solubilizes the protein and coats it with negative charges.
Then we apply the proteins to the wells at the top of a polyacrylamide gel.
The gel is not solid. It consists of a labyrinth of tunnels through a meshwork of fibres.
A voltage pulls the proteins through the gel.
The smaller proteins work their way through the gel towards the positive electrode faster than the larger proteins. They reach the positive electrode first.
Usually one of the wells contains a mixture of proteins of known molecular mass to serve as standards.
A tracking dye is often added to the solution. It typically moves through the gel faster than the proteins and enables tracking the solution through the gel.
Following electrophoresis, a stain is added to make the proteins appear as distinct bands in the gel.