Heatwaves have a significant impact on urban areas, driving efforts to mitigate the urban heat island (UHI) effect through green infrastructure and sustainable planning. By integrating computational fluid dynamics (CFD) with digital twin technology, this study evaluates the effectiveness of climate adaptation infrastructures in urban areas. However, applying digital twin technology for UHI analysis and integrating data into actionable insights faces challenges due to long simulation times and focus of analysis. This study aimed to mitigate the societal impacts of urban heat islands and address the gaps in existing research and technology. A new machine learning model was developed to improve the urban thermal environment by optimizing green spaces and combating urban heat islands in densely populated cities, by integrating artificial intelligence (AI) and digital twin technology. Combining the strengths of Random Forest and XGBoost, the model was trained and tested on a dataset derived from CFD simulations to identify effective strategies for urban green spaces allocation. The primary results of the study are divided into three parts. First, a high-precision model for data augmentation and green space optimization was developed using machine learning. Second, the developed model reduced the time required for CFD simulation analysis from over 400,000 h to less than 1 h. Finally, the study found that the strategic placement of green spaces could result in approximately 1 % of the total urban area temperature. The results highlight the importance of strategic planning in the distribution of urban green space for effective mitigation of heat islands. The proposed model can be used as an efficient tool for sustainable urban development and is consistent with the overall goal of creating more livable and climate-resilient cities.