Dear student
In chlorine molecule, the shared pair of electrons are attracted equally between two chlorine atoms. This results in nonpolar bond.
In case of HCl, electrons are not equally shared between H -Cl. Shared electrons are more strongly attracted towards chlorine,which is more electronegative. Hence, it is polar.
Regards