Trains to León (and to Astorga) depart from Chamartín train station. To reach Chamartín train station, take a Cercanías (Shuttle) train from the Terminal 4 of the airport (they run every 30 minutes). The Cercanías ride will be free if your ticket from Madrid to León (or Astorga) has a "combinado cercanías" code (if you take, for example, an AVE or an Alvia, it'll have it) and if you don't plan to take it more than 4 hours before the departure of your train to León (or Astorga). Even if the Cercanías ride is free for you, you have to get a ticket for the Cercanías (it'll be free but you can't take the train without it).
There are also a few direct trains from Madrid to Astorga so no need to go to León unless you want to make it.
www.renfe.com for info about schedules and fares as well as for ticket purchase (usually ticket purchase opens 2 months in advance; sometimes later).
If you don't want to go to the downtown, out of the Terminal 4 of the airport, you can take an Alsa (
www.alsa.es/en) bus to León (and to Astorga).
You can take either a bus (with Alsa) or a train (with RENFE) from León to Astorga if you decide to stop in León on your way to Astorga.