Magnesium comes after sodium in the same period. Atoms of both elements have three electron shells. But the nuclear charge of sodium is +11 and that of magnesium is +12. Hence, the electron shells are pulled inward more strongly Mg atom than in Na atom. Hence, sodium atom is greater than magnesium atom.
Hope this helps:)