your question is not clear..whether you are asking why to create donor and acceptor levels or how to create.
if it is why....in case of semiconductors, to enhance the conductivity we dope with an impurity of third or fifth order. so that it will change to p type or n type. Adding impurity will introduce new energy eigen states in the bandgap. so that bandgap decrease thereby allowing carrier flow for less amount of energy.
if it is how...physically we add impurities to semiconductors by using various techniques. donor levels will be nearer to conduction band and acceptor levels will be nearer to valance band.
I think you are struggling with the fact, that the doping adds additional bands for conduction within the band gap, and this contradicts the principle of it being a band gap, where no energy levels are possible ?.
Now, the band gap being a forbidden zone is only the case for the pure semiconductor, meaning when no impurities are added. Adding impurities, like doping, adds extra conduction and valence bands. For n-doping, a (small) band full of electrons is added just below the top of the band gap, for p-doping a (sall) band full of holes is added just above the band gap.