Although solid sodium chloride is a poor conductor of electricity, when molten the sodium and chloride ions are mobilized, which become charge carriers and allow conduction of electric current.
Hence the sodium ions are reduced to metallic form in preference to those of calcium.
Both the products of the electrolysis, sodium metal and chlorine gas, are less dense than the electrolyte and therefore float to the surface.
Perforated iron baffles are arranged in the cell to direct the products into separate chambers without their ever coming into contact with each other.
This is done in order to achieve useful current densities in the electrolyte despite its inherent electrical resistance.