This question already has an answer here:
Consider this image and quotations from Basics of Radio Astronomy for the Green Bank Telescope:
When a continuous spectrum is viewed through some cool gas, dark spectral lines (called absorption lines) appear in the continuous spectrum.
If the gas is viewed at an angle away from the source of the continuous spectrum, a pattern of bright spectral lines (called emission lines) is seen against an other-wise dark background.
As the radiation passes through a gas, certain wavelengths are absorbed. Those same wavelengths appear in emission when the gas is observed at an angle with respect to the radiation source.
Since the gas absorbs photons and then re-emits them isotropically by my logic there is no reason why there should be any dark lines appearing on the absorption spectrum. Explicitly, I don't understand why the diagram doesn't look like this instead:
Since, as I understood it, this should be the case:
Since the absorbed photons in the gas are re-emitted why do we see any dark lines?