The more localized the excess electron charge in the nucleophile, the better its nucleophilicity.
But..., the higher its interaction con the solvent.
Solvents act as screens that shield nucleophile's nucleophilicity.
Therefore, the polar properties of the solvent are vital for a nucleophilic substitution to success.
The reaction takes place much more quickly in DMF (dimethylformamide), a solvent without hydrogens that can participate in hydrogen bonding.
In contrast, the N-H groups of formamide and its N-methyl derivative or the O-H group of methanol, are able to strongly associate to chloride by tight hydrogen bonding, shielding the anion and considerably slowing down its reaction.