The inversion of configuration occurs in nucleophilic substitution reactions (SN2) where the nucleophile attacks the carbon opposite to the leaving group, causing the configuration to invert.
1-chloropropane will undergo inversion of configuration, as it undergoes an SN2 mechanism. However, 2-chloro-2-methylpropane, being a bulky tertiary substrate, undergoes an SN1 mechanism, where inversion may or may not occur.