As we know, the formation of one mole of a compound from its elements in their most stables states of aggregation is called molar enthalpy of formation.
Thus, in equation (1) HCl is formed from most stable elemental state of Hydrogen & chlorine.
H2(g) + Cl2(g) → 2HCl. \(\Delta\)H1 = -x KJ.
∴ formation of one mole of HCl-
\(\frac12\)H2(g) + \(\frac12\)Cl2(g) → HCl \(\Delta H\) = \(\frac{\Delta H_1}2\) = \(-\frac{x}2\) KJ
Hence, \(\Delta\)Hf of HCl will be -x/2