Phosphorus has one excess valence electron (compared with Si) after forming the four covalent bonds normally with silicon. This excess electron gives rise to electronic conduction. That is why silicon becomes semi-conductor on doping with phosphorus. It is called n-type semi-conductor.
Gallium has only three valence electrons. It creates an electron deficient bond or a hole when it is doped with silicon. Such holes can move in the crystal giving rise to electrical conductivity. Thus silicon doped with gallium is also semi-conductor due to movement of holes. It is called-p-type semiconductor.