DH of formation for an element is 0. The definition of DH of formation is the formation of 1 mol of a substance from its constituent elements. How much energy does it take to make 1 mol of H2 or C, if you are starting with 1 mol of H2 or C?
On the other hand, if you set fire to H2 (to make H2O) or C (to make CO2) there will be energy released.
Check what the values you're given represent, it is important whether they are DfH or DcH