If travelling by train then you will go through Valladolid which is the home of rugby in Spain and one of my favourite Spanish cities. In addition to rugby, Valladolid is also famous for its tapas and the highly innovative Universidad Europes Miguel de Cervantes.
When you get to León be sure to go check out
Panadería La Masera-Confitería Asturias
https://maps.app.goo.gl/ay43tuBK82NacDHY9
They serve the best pastries and the young woman who works there really likes Kiwi pilgrims
View attachment 165532
View attachment 165533
View attachment 165534
View attachment 165535
I would go in to buy one or two items and then when I opened the paper bag to eat them I would discover three other items to try that I had neither ordered or paid for
Also if you have time check out the Gaudi museum in León. It was eye opening for me.
You may already have your accommodation in León sorted out but if not then I recommend Albergue San Francisco de Asis which is very reasonably priced, has single rooms and lets you stay more than one night and (most importantly) is just around the corner from the panaderia.
Getting back to trains, there is a small town called Palencia between Madrid and León which is where the train line has a major junction and the RENFE site sometimes isn't so good at showing options for train journeys that require changing train and so it is worth doing a search for Madrid to Palencia and then Palencia to León to pick up some of the other options.
I love travelling on the train in Spain because it is relatively cheap, fast and so much more comfortable because I can get up and walk around the carriages plus the seats have more room and are more comfortable. I also quite like talking to strangers when I travel and this seems to be more acceptable on a train where people have the space to move away if they don't want to engage whereas in a bus you are jammed in with the person next to you and if you don't want to talk back for some reason then it is hard to avoid them.
One more thing, I don't know your age (and don't need to) but if you are over 60 then you can get a seniors discount card called Tarjeta Dorada that gives you up to 40% discount on some train fares. See
https://www.renfe.com/es/en/travel/prepare-your-trip/descuentos/mayores-de-60