Great hiking near Madrid
If you're just visiting in Madrid (or, if you're a local without a car), the Maciza de Peñalara National Park is perhaps the best hiking area you can find. You can get there on the Cercanias line to Cercedilla (leaving from Nuevos Ministerios) and then you catch an old-school nature train up the mountain to the park. You have you buy your nature-train tickets at Nuevos Ministerios because the train only has a couple of cars and it fills up quickly.
Once you arrive, it's like being a million miles from the dry, urban streets of Madrid. If you go in May and April, you'll still be in time to have snow-covered peaks and trails and plenty of ponds and waterfalls.