Metals which are placed above hydrogen in electrochemical series can displace hydrogen from an acid and which are placed below hydrogen in this series cannot displace hydrogen from an acid. In other words only those metals can liberate hydrogen from the acid which have negative values of reduction potentials.
Mercury cannot displace hydrogen from acid beacuse it is placed below hydrogen in ECS and its reduction potential is positive while Ca,Al and Zn can displace hydrogen from acid because they are placed above hydrogen in ECS and their reduction potential are negative. Hg+HCl⟶× Ca+2HCl⟶CaCl2+H2 2Al+6HCl⟶2AlCl3+3H2 Zn+HCl⟶ZnCl2+H2