This problem includes concept of $S _{ N } 1$ and $S _{ N } 2$ reaction and factor affecting $S _{ N } 1$ and $S _{ N } 2$ reaction.
During $S _{ N } 2$ reaction of alkyl halide, inversion of configuration takes place instead of rearrangement.
While $S _{ N } 1$ reaction occurs through the formation of carbocation intermediate which is favoured by the presence of lewis acid and aprotic solvent.
Reatrangement of product is also possible in this case.