Carbon can neither lose four of its electrons nor gain four electrons as both the processes require an extra amount of energy and would make the system unstable. Therefore, it completes its octet by sharing its four electrons with other carbon atoms or with atoms of other elements.
The bonds that are formed by sharing electrons are known as covalent bonds. In covalent bonding, both the atoms share the valence electrons, the shared electrons belong to the valence shells of both the atoms.
In CH3Cl, carbon requires 4 electrons to complete its octet, while each hydrogen atom requires one electron to complete its duplet. Also, chlorine requires an electron to complete the octet.
Therefore, all of these share the electrons and as a result, carbon forms 3 bonds with hydrogen and one with chlorine.