In recent times, there has been increasing interest in renewable power generation and electric vehicles within the domain of smart grids. The integration of electric vehicles with hybrid systems presents several critical challenges, including increased power loss, power quality issues, and voltage deviations. To tackle these challenges, researchers have proposed various techniques. Effective management of energy systems is essential for maximizing the benefits of integrating a hybrid system with a microgrid at an electric vehicle charging station. This research specifically aims to optimize the location and sizing of such a hybrid system within the microgrid. Additionally, an improved binary quantum-based Elk Herd optimizer approach is proposed. This approach addresses for optimally managing renewable energy sources and load uncertainty. The proposed system also considers the stochastic nature of electric vehicles and operational restrictions, encompassing diverse charging control modes. The proposed technique performance is implemented in MATLAB platform and compared against existing approaches. The analysis demonstrates the effectiveness in achieving optimal location and sizing for a hybrid system with an electric vehicle charging station. Additionally, the proposed approach contributes to minimizing power loss, electricity costs, and average waiting time. Furthermore, the proposed approach reduces computing time, net present cost, and emissions are 12.5 s, 1.1×106 dollar, 2.21×108 g year−1, respectively.