Hydrogen-powered heavy-duty vehicles will transform the logistics landscape, but their extensive adoption presents substantial challenges. Matching hydrogen demand with supply, scaling up infrastructure, controlling carbon emissions targets, and integrating with renewable energy sources are significant obstacles to overcome. This paper addresses these challenges by modeling a hydrogen station for heavy-duty vehicle fleets using Matlab-Simulink software. The hydrogen station components proposed are individually modeled: (1) the electrolyzer model generates hydrogen and oxygen by electrolysis consuming water and electricity; (2) the hydrogen reformer model generates hydrogen and carbon dioxide through steam methane reforming or ethanol reforming; (3) the hydrogen storage tank; and (4) carbon capture and storage. These models were compiled into functional mock-up units (FMU) to facilitate further exploration. This paper incorporates metaheuristic optimization techniques to address the design complexities and enhance the performance of hydrogen stations under various operating conditions. Multiple optimization objectives have been considered, including reducing carbon emissions and reducing the total monetary cost. Furthermore, several critical constraints are integrated to ensure realistic scenarios. These constraints include the accumulated hydrogen production that meets daily demand and the limitations in resource consumption. Finally, the combination of the FMU approach with metaheuristics techniques demonstrates the potential for the optimal hydrogen infrastructure design.