This study proposes and employs the chaotic gazelle optimization algorithm in the design of a hybrid energy system (HES) in an Indian rural region. The algorithm being proposed is verified and contrasted with current optimization algorithms for several popular benchmark functions, such as fixed dimensions, multimodal, and unimodal. Following that, it has been applied to develop HES, which will be capable of providing power to remote areas where grid supply is scarce. The HES underneath consideration includes diverse grid-dependent and off-grid configurations incorporating solar photovoltaic (SPV) panels, biomass (BGM), biogas (BGG), and a battery energy storage system and found the most optimal one. The key objective is to minimize the net present cost (NPC), which embraces all project expenses, while sticking to a certain number of constraints such as unmet load, higher and lower boundaries, and so on. The simulation results are compared to diverse algorithms such as the original gazelle optimization algorithm (GOA), chaotic Chebyshev GOA, sinusoidal chaotic map-based GOA, Levy-GOA, particle swarm optimization algorithm (PSOA), levy flight-based adaptive particle PSOA, comprehensive learning PSOA (CLPSOA), heterogeneous comprehensive learning PSOA, and others. These results highlight the usefulness of the suggested algorithm for addressing the design issue, as well as its superior efficiency when compared to competing algorithms. Combining SPV panels, BGM, and BGG with battery storage in grid mode yields the best-performing HES configuration, with a NPC of $4.9756 × 105 and a cost of energy (CE) of $0.0690/kWh. Moreover, sensitivity analysis has also been conducted on the suggested HES by considering various sensible parameters. The findings emphasize the need for combining SPV, BGM, and BGG in these areas, with batteries being essential for controlling and maximizing energy flow in HES systems.