The general mechanism for nucleophilic acyl substitution in carboxylic acid derivatives involves two key steps:
Nucleophilic attack on the carbonyl carbon, forming a tetrahedral intermediate.
Elimination of the leaving group, which reforms the carbonyl and completes the substitution.
In the first step, the nucleophile attacks the electrophilic carbonyl carbon, which is highly reactive due to the partial positive charge. This creates a tetrahedral intermediate with a negative charge on the oxygen atom. In the second step, a leaving group, which is often a better leaving group than the nucleophile, departs, and the carbonyl functionality is restored. This mechanism is common in reactions involving carboxylic acids, anhydrides, esters, and amides.