Foreign direct investment (FDI) plays a pivotal role in the transition to renewable energy (RE) and has garnered significant attention globally. While much research exists on the impact of FDI on RE, studies on components of FDI like greenfield (GF) FDI and mergers and acquisitions (M&A) FDI are limited. Existing studies provide conflicting results, necessitating a thorough analysis to determine the true impact of GF FDI and M&A FDI on RE capacity. This study aims to bridge this gap by focusing on 41 developing countries from 2003 to 2022. Data reveals a non-linear relationship between GF FDI and RE capacity, prompting the introduction of a non-linear term of GF FDI to examine its impact on RE capacity. The study employs robust statistical methods, including IV-GMM, quantile instrumental variable regression, machine learning and neural networking. Results show a U-shaped relationship between GF FDI and RE capacity, while M&A FDI positively impacts RE capacity, making it an attractive option for boosting RE deployment. Public debt and political stability are also crucial for enhancing RE capacity. Policy suggestions emphasize component-wise FDI strategies, prioritizing M&A FDI early in the energy transition, easing M&A processes, and supporting GF FDI for long-term benefits.