The projector provides the white light, which has a continuous spectrum, as confirmed by the prism. The bunsen and sodium bicarbonate provides the sodium gas, which absorbs the incident light at its characteristic frequencies, re-emitting in all directions to leave an dark line in the continuous spectrum.
If you look very carefully, there are actually dark lines in the spectrum of sunlight. The absorption spectrum is the result of the (cooler outer) atmosphere of the Sun selectively absorbing photons emitted by the (centre of the) Sun itself.
Even a street lamp displays an absorption spectrum. The absorption is by the cooler and sodium at the outer layers, of the light emitted by the inner layer high pressure sodium gas.