DPD,
It may well depend on schedules and I am challenged to find a good train schedule on Renfe. Rick Steves best of Spain mentions two trains a day with transfer to AVE in Malaga.
You don't need to transfer in Malaga.
There are 4 trains a day running from Madrid (Puerta de Atocha) to Granada; at 7:20, 9:35, 14:35 & 17:35. The journey will take about 4 hours. As Nestor has explained, you will board an AVE train in Madrid, then transfer to a bus in Antequera. This bus (supplied by Renfe) will transport you to Granada's train station, which is closer to the city center than the train station.
It appears that Renfe has a promotional ticket for €30/person right now which is great deal, IMO.
You can see the train schedules here: Renfe.com
When you arrive to Barajas- Madrid Airport, you can take the C-1 or C-10 Cercanías train from Terminal 4 to Puerta de Atocha station.
You can also take the ALSA BUS from the Madrid Airport to Granada.
Did you book your Alhambra tickets already? The last time I checked, there weren't any tickets left for the month of May.
Enjoy your trip!