This paper presents an optimization approach for optimal component sizing of PEM fuel cell (PEMFC)-battery hybrid energy system (HES) to provide the driving force required to haul passenger trains. The objective function is the minimization of the cost of HES, which subjects to the constraints of battery state-of-charge limit, PEMFC capacity constraint, and the instantaneous power balance constraint. A model of PEMFC-battery HES suitable for locomotive application is formulated. Two energy management strategies (EMS) are proposed to ensure the balance between instantaneous power demand and supply. The EMS is suitably incorporated into the particle swarm optimization based solution algorithm. Three practical drive cycles are used in the simulation study. The simulation study reveals that the sizes of PEMFC and battery depend on the choice of EMS, average speed of train, and slope of the railway track. The fuel consumption and dynamic behaviour also depend on the choice of EMS.