A substitution reaction involves the displacement of one atom or group in a molecule by another atom or group. Aliphatic compounds undergo nucleophilic substitution reactions. For example, a haloalkane can be converted to a wide variety of compounds by replacing halogen atom (X) with different nucleophiles (electron-rich).
In case of aromativ hydrocarbons, an electrophilic reagent attacks the aromatic ring because the latter is electron rich. The leaving group is always one of the hydrogen atom of the ring. For example, in case of nitration the –NO2 group replaces one hydrogen atom of benzene.