Dear Student
It is because, from molten NaCl, only metallic sodium and chlorine gas can be formed. So, reduction of sodium and oxidation of chlorine is needed. Hence, the migration to the cathode & anode, respectively.
Cathode means negatively charged electrode. We can see that Na is positively charged. So, it must get attracted to negatively charged electrode (cathode). Positively charged electrode will repell it. So, it can't get deposited there.
Similarly for Cl deposition at anode.
Regards