well, i'll try to explain it in the simplest ways
light behaves as both a wave and particles. particles of light are called photons. light also has different wavelengths an frequencies - giving different colours. Atoms can absorb these photons. So when an atom (in this case, hydrogen) absorbs these photons of light (energy), its electrons get excited. this means they jump up to another energy level (or sub-shell) and when the go back down to their normal level - they emit that energy back out (as photons) - giving off the coloured light they absorbed
this gives you the absorption spectrum (black lines on coloured back ground) and the emission spectrum (coloured lines on black back ground) the lines are on the same place because the energy levels are the same