Metals are electropositive and they release electrons readily. These electrons react with hydrogen ion of the acid and liberate hydrogen gas
2H+ + 2e- ---> H2
Not all metal releases hydrogen from acid. Only those metal which are more reactive than hydrogen will release hydrogen from the acid. Ex., Zn, Fe relases hydrogen and copper does not.
Zn + 2HCl ---> ZnClā2 + H2
Non metals are electronegative in nature and they will accept electrons only. They wont release electron and does not react with acid.