Why does hydrogen give an electron instead of receiving one?
Whether or not hydrogen (or any atom or molecule) gives or
receives electrons depends on the nature of the thing it is
interacting with. If the other atom is more electronegative than
hydrogen, it will take an electron from hydrogen. If hydrogen is
the more electronegative species, hydrogen will take the electron.
There are many reactions in which electrons are donated or
received, and to understand them, you must look at the nature of
the two species involved in the exchange. Primarily the answer will
depend on the relative electronegativity of the two atoms (or for
molecules, their relative nucleophilicity or electrophilicity). One
way to think about it is like a game of tug-of-war. If two people
pull in opposite directions on a piece of rope, whoever is stronger
will pull the rope towards them. In the same way, whichever
molecule "wants" the electron more will take it from the other.
What makes a molecule or atom "want" an electron more than another
is another topic...