SO2 is a bent molecule with a central sulfur atom bonded to two oxygen atoms. The oxygen atoms are more electronegative than sulfur, causing a separation of charge. This results in a bent molecular geometry and a net dipole moment, making SO2 a polar molecule.
NH3 is a trigonal pyramidal molecule with a central nitrogen atom bonded to three hydrogen atoms. Again, the electronegativity difference between nitrogen and hydrogen leads to a separation of charge. The arrangement of the atoms in NH3 gives it a net dipole moment, making it a polar molecule.