Construction machines are heavy-duty equipment and a major contributor to the environmental pollution. By using only electric motors instead of an internal combustion engine, the problems of low engine efficiency and air pollution can be solved. This paper proposed a novel energy management strategy for a PEM fuel cell excavator with a supercapacitor/battery hybrid power source. The fuel cell is the main power supply for most of the excavator workload while the battery/supercapacitor is the energy storage device, which supplies additional required power and recovers energy. The whole system model was built in a co-simulation environment, which is a combination of MATLAB/Simulink and AMESim software, where the fuel cell, battery, supercapacitor model, and the energy management algorithm were developed in a Simulink environment while the excavator model was designed in an AMESim environment. In this work, the energy management strategy was designed to concurrently account for power supply performance from the hybrid power sources as well as from fuel cells, and battery lifespan. The control design was proposed to distribute the power demand optimally from the excavator to the hybrid power sources in different working conditions. The simulation results were presented to demonstrate the good performance of the system. The effectiveness of the proposed energy management strategy was validated. Compared with the conventional strategies where the task requirements cannot be achieved or system stability cannot be accomplished, the proposed algorithms perfectly satisfied the working conditions.