When planning a hybrid energy system (HES) that incorporates both renewable and non-renewable energy sources—those that rely on fossil fuels—the primary considerations are the total cost of the system and the CO? emissions. In this paper, we will investigate the typical hybrid energy system (HES) that incorporates both renewable and non-renewable energy sources involving a detailed simulation process that may require specific inputs, models, and data. Then, we employed dual optimization methods: genetic algorithm (GA) and particle swarm optimization (PSO). The consequences of GA and PSO execution in the bus timetabling problem depict that the GA algorithm is better at finding the optimal solution in terms of accuracy and iteration. Additionally, the GA algorithm is also superior to the straightforwardness of the techniques used. So, in this work, we employed a Genetic Algorithm Optimization (GA)–-based optimal sizing technique for HES configurations that include sustainability wind turbines (WTs), battery storage (BS), and diesel generators (DGs). HES improved power delivery to a rural community in the Wasit Province, Iraq, situated at 46° - 36° and 32° - 31° in the country's southeastern central region. Throughout the project's 25-year lifespan, the optimization primarily aims to minimize the total cost (CT) and total CO? emissions (ECO2T). The outcomes demonstrate that the GA algorithm may, with continuous electricity supply, minimize the objectives while meeting the load demand.