Why does the led turn dim gradually and then turn off when attached to a capacitor in series?
Short answer: Current stops when the capacitor gets charged up to the battery voltage.

When current flows through the circuit, the bulb lights up.  In this case you can consider the bulb as a 'current detector'.  Current in this case is flow of charge, and the charge carriers are electrons.  They are pushed around because the battery pushes them with an electric field.  

Now look at the capacitor symbol.  It indicates that there is a gap between the plates.  Electrons normally don't jump this gap.  But you know there is current because the bulb initially turns on.  So what is happening?  Electrons are effectively being accumulated at one of the plates of the capacitor, while the opposite plate has electrons being removed, "charging it".  But they can't accumulate indefinitely, because the more they accumulate, the more the repel each other.  It basically takes energy/work to do this, and you can consider that the capacitor is storing this energy, and can effectively be released later on.  As the capacitor gets charged, the voltage accross it augments, until the battery cannot push more electrons.  At this point the capacitor voltage has equalized the battery voltage.  No more electrons flow, the bulb finally turns off.

To release the energy stored in the capacitor, remove the battery from the circuit and connect the wires together.  You should see the same effect (bulb turning on, then dimming until off), because the battery no longer keeps those electrons pushed and they return to neutrality via the bulb.