Reducing reliance on fossil fuels has driven the development of innovative technologies in recent years due to the increasing levels of greenhouse gases in the atmosphere. Since the automotive industry is one of the main contributors of high CO2 emissions, the introduction of more sustainable solutions in this sector is fundamental. This paper presents a novel energy management system for fuel cell hybrid electric vehicles based on dynamic programming and adaptive neuro fuzzy inference system methodologies to optimize energy distribution between battery and fuel cell, therefore enhancing powertrain efficiency and reducing hydrogen consumption. Three different approaches have been considered for performance assessment through a simulation platform developed in MATLAB/Simulink 2023a. Further validation has been conducted via a rapid control prototyping device, showcasing significant improvements in hydrogen usage and operational efficiency across different drive cycles. Results manifest that the developed controllers successfully replicate the optimal control trajectory, providing a robust and computationally feasible solution for real-world applications. This research highlights the potential of combining advanced control strategies to meet performance and environmental demands of modern heavy-duty vehicles.