Does it make sense to do a day-trip from Madrid to Alhambra? Is 2 days a reasonable time?
No. The logistics and time it takes to travel there make it impractical, especially since the Alhambra has timed entrances. Personally, one day to travel there, one day seeing it, and one day to return is more practical.
It's not possible as a day-trip. At least one overnight is necessary.
Before proceeding too far with your plans, check the ticket situation for the Alhambra. It does sell out. If tickets aren't yet on sale for your date, make note of when they become available so you can jump right on them.