An unprecedented heatwave hit the Yangtze River Basin (YRB) in August 2022. We analyzed changes of anthropogenic CO2 emissions in 8 megacities over lower-middle reaches of the YRB, using a near-real-time gridded daily CO2 emissions dataset. We suggest that the predominant sources of CO2 emissions in these 8 megacities are from the power and industrial sectors. In comparison to the average emissions for August in 2020 and 2021, the heatwave event led to a total increase in power sector emissions of approximately 2.70 Mt CO2, potentially due to the increase in urban cooling demand. Suzhou experienced the largest increase, with a rise of 1.12 Mt CO2 (12.88 %). Importantly, we observed that changes in daily power emissions exhibited strong linear relationships with temperatures during the heatwave, albeit varying sensitivities across different megacities (with an average of 0.0076 ± 0.0075 Mt d−1 °C−1). Conversely, we find that industrial emissions decreased by a total of 8.45 Mt CO2, with Shanghai seeing the largest decrease of 4.71 Mt CO2, while Hangzhou experienced the largest relative decrease (−21.22 %). It is noteworthy that the majority of megacities rebounded in industrial emissions following the conclusion of the heatwave. We convincingly suggest a tight linkage between the reductions in industrial emissions and China's policy to ensure household power supply. Overall, the reduction in industrial emissions offset the increase in power sector emissions, resulting in weaker emissions for majority of megacities during the heatwave. Despite remaining uncertainties in the emissions data, our study may offer valuable insights into the complexities of anthropogenic CO2 emissions in megacities amidst frequent summer heatwaves intensified by greenhouse warming.