Renewable energy systems have the potential to address increasing energy demand, mitigate environmental degradation, and decrease reliance on fossil fuels. Wind and solar power are examples of renewable energy sources that are characterized by their cleanliness, environmental friendliness, and sustainability. The combination of wind and solar energy is motivated by each energy source’s inherent variability. The objective of this study is to assess the technical, economic, and environmental aspects of a hybrid system designed to provide energy. This study utilizes numerical simulation and develops a novel model using the gray wolf optimization (GWO) algorithm to assess the technical, economic, and environmental consequences of adopting a hybrid system. The evaluation focused on determining the optimal configuration of a greenhouse unit in Najran, Saudi Arabia, over a period of 20 years. The results showed that the diesel generator produced 42% of the required energy when combined with photovoltaic generators, while photovoltaics produced 58%. The wind turbine generated 23% of the required power while the remaining 77% was produced by the diesel generator. Finally, diesel generators, photovoltaics, wind turbines were observed to generate 37%, 48%, and 15% of the required energy, respectively. This outcome is consistent with current knowledge because solar and wind systems reduce pollution. However, the diesel generator–photovoltaic–wind mode is the preferred method of reducing emissions. Finally, the rate of return on investment for diesel generators is 3.4 years, while for diesel-photovoltaic generators and the triple array it is 2.5 and 2.65 years, respectively.