Technically, metal + acid ----> metal salt +water.
But when we look at HNO3, it has a tendency to form H2O and not H2 when it reacts with metals.
But, Magnesium and Mangenese are two metals that traditionally, liberate H2 and not H2O when they react with HNO3. This is because, when they initially react, they do form H2O, but the Mg or Mn metals are strong reducing agents and hence they reduce H2O and themselves oxidise. This leaves them with only H2 gas, instead of H2O.
Hence, when Mg/Mn reacts with Nitric acid to form a salt and H2O, but the H2O is quickly (almost instantaneously) reduced and converted to H2 gas.