Climate change and human expansion are primary drivers of ecological degradation in metropolitan areas, underscoring the necessity of examining the complex interplay between environmental factors and ecological quality. This study investigates the spatial–temporal evolution of ecological quality within the Beijing Metropolitan Area (BMA) from 2000 to 2020 and proposes a comprehensive assessment framework integrating machine learning techniques and spatial heterogeneity analyses. Ecological quality is quantitatively evaluated using the Remote Sensing Ecological Index (RSEI), leveraging MODIS imagery, climate data, land use patterns, and soil characteristics. Spatial clustering patterns of ecological quality are identified through RSEI calculations and spatial autocorrelation analyses, while future trends are projected utilizing the coefficient of variation, Sen and Mann–Kendall methods, and the Hurst index. The XGBoost algorithm elucidates the multifaceted driving mechanisms, and geographically weighted regression (GWR) quantifies the spatial variability of these drivers. The application of XGBoost reveals nonlinear relationships among ecological drivers, and GWR enhances spatially explicit interpretations of these relationships. Results indicate an overall improvement in ecological quality, with the RSEI rising from 0.428 in 2000 to 0.480 in 2020, corresponding to an annual average increase of approximately 0.55%. Notable spatial variability exists, with ecological quality consistently higher in the Taihang Mountains relative to lower-altitude plains. Current ecological protection policies have effectively mitigated ecological degradation in approximately 32.35% of the study area; however, significant environmental pressures persist in urban–rural transition zones and plain regions. Topography and soil properties emerge as dominant influencing factors, while climate indirectly influences ecological quality by shaping vegetation coverage. Human activities predominantly exert negative impacts within urban expansion zones. This research offers a robust quantitative framework for regional ecological conservation, providing critical insights to inform sustainable development and environmental policy-making.