Hi, I believe this should belong in the chemistry section. But nevertheless, here is the solution,
To achieve a noble gas electronic configuration, the overall charge has to be 0 as noble suggest stable.
For such configuration to happen, in your syllabus, when the question mentions LOSING / GAINING electrons, it is referring to ionic bonding.
For ionic bonding to occur, metal atom must be bonded to a non-metal atom.
A metallic ion like sodium ion is always +1 charge
A non-metallic ion like chlorine ion is always -1 charge.
So for a stable Sodium Chloride/NaCl to achieve a noble(stable) state, an electron will be lost chlorine ion where this electron will be gained by sodium ion.
When chlorine ion (-1 charge) loses an electron, it becomes 0 charge, which is stable.
When sodium ion(+1 charge) gains an electron, it becomes 0 charge which is stable.
And hence both are stable and formed the stable noble compound called NaCl.