It may be not better than much closer places, but a time honoured retreat from the heat has long been Ootapramund aka "Oooty", a "mere" 6 to 12 hours / 550 km from Madras (aka Chennai).
How does an average June high of 18.3 and record June high of 22 C sound ? :-).
Google maps view here - Ooty at about centre. Missionary children used to be sent there to boarding school.
I'm told it has the only rack railway in India, and one of the two best "toy trains" in India - real trains but small and following steep and winding alpine routes - and suitably hard to get tickets on.
Wikipedia - Nilgiri Mountain Railway
- Wikipedia: The Nilgiri Mountain Railway (NMR) is one of the oldest mountain railways in India. The NMR was declared by the UNESCO as a World Heritage Site in July 2005. This connects Ootacamund with the town of Mettupalayam, at the foothills of the Nilgiri Mountains. It is the only rack railway in India, and uses the Abt system.
Map and example bus route and timetable here. Many others available.
They claim the distance is 549 km, but others say otherwaise. YMMV* :-).
This site https://www.cleartrip.com/tourism/bus/ooty-to-chennai-bus.html
say Ooty to Channai by bus takes 5.3 to 12 hours. depending on operator etc. This varies from the (more likely) 12 to 12 hours suggested in the link supplied by @vedic.
There are 5 bus operators providing Ooty to Chennai bus services. K.P.N, SRM Transports, NAS Travels, Shama Sardar Travels, Alsafa Travels are the top bus operators providing 3, 1, 1, 1, 1 daily buses on this route respectively. The journey takes between 5.3 - 12.0 hrs to complete depending on the operator and the bus type.
One can also avail of A/C Sleeper (2+1), A/C Semi Sleeper (2+2), Non A/C Seater (2+2), A/C Seater push back (2+2) on this route. The first bus leaves at around 18:00 Hrs and last bus at 19:00 Hrs. The most preferred boarding points for Ooty to Chennai are Ooty, Bus stand with 7, 1 buses departing daily. The average ticket price between Rs. 599 and Rs. 975.0 depending on bus type and operator.
Wikipedia - Ootacamund
*YMMV - Your Mileage May Vary :-)