What is a transfer of electrons?
Transfer of electron in chemistry is the process by which an atom "hands over" one or more of their electron
According to current theories dating mainly the 19-20th centuries, the world is made up of atoms.
Atoms in general are unstable when in single form, except noble gases, e.g. Helium.
In order to "solve" their instability issue, atoms combine.
There are mainly two types of Bonds, the name given for these combinations: Ionic and Covalent bond (https://en.wikipedia.org/wiki/Covalent_bond).
In the former, we have a distortion of the orbital towards the strongest one, "negativity", whereas in the latter we have a "equal" sharing.
In the ionic bond we say the electron was transferred, notwithstanding it does not really happen.
What happens is that the electron(s) will stay closer to one nucleus, e.g. H-Cl (Hydrogen chloride, https://en.wikipedia.org/wiki/Hydrogen_chloride), in the case mentioned, the electronegativity, https://en.wikipedia.org/wiki/Electronegativity, of Cl is much higher, thus the hydrogen "loses" its only electron, if it loses at all, it will be just a proton, https://en.wikipedia.org/wiki/Hydrogen
Ionic bonds is in general for metals, whereas covalent is for semi-metals in general. https://en.wikipedia.org/wiki/Semimetal