Understanding the resilience of photovoltaic (PV) systems to extreme weather, such as heatwaves, is crucial for advancing sustainable energy solutions. Although previous studies have often focused on forecasting PV power output or assessing the impact of geographical variations, the dynamic response of PV power outputs to extreme climate events still remains highly uncertain. Utilizing the PV power data and meteorological parameters recorded at 15 min intervals from 1 July 2018 to 13 June 2019 in Hebei Province, this study investigates the spatiotemporal characteristics of the PV power output and its response to heatwaves. Solar radiation and air temperature are pivotal in enhancing PV power output by approximately 30% during heatwave episodes, highlighting the significant contribution of PV systems to energy supplies under extreme climate conditions. Furthermore, this study systematically evaluates the performance of Random Forest (RF), Decision Tree Regression (DTR), Support Vector Machine (SVM), Light Gradient Boosting Machine (LightGBM), Deep Belief Network (DBN), and Multilayer Perceptron (MLP) models under both summer heatwave and non-heatwave conditions. The findings indicate that the RF and LightGBM models exhibit higher predictive accuracy and relative stability under heatwave conditions, with an R2 exceeding 0.98, with both an RMSE and MAE below 0.47 MW and 0.24 MW, respectively. This work not only reveals the potential of machine learning to enhance our understanding of climate–energy interplay but also contributes valuable insights for the formulation of adaptive strategies, which are critical for advancing sustainable energy solutions in the face of climate change.