Dear student,
Some elements and compounds can be both reducing or oxidizing agents. Hydrogen gas is a reducing agent when it reacts with non-metals and an oxidizing agent when it reacts with metals.
1 )Hydrogen acts as reducing agent when react with non-metals
for eg. - H2 + F2 2HF
2)Hydrogen act as reducing agent in the reaction of some metal oxide with hydrogen (metal less electropositive than zinc such as Cu, Fe, Pb)
CuO + H2 Cu + H​2O
ZnO + ​H2 Zn + H​2O
PbO + ​H2 Pb + H​2O
Fe3O4 + ​4H2 3Fe + 4H​2O
Regards