In Sn2 nucleophilic substitution reactions,the attacking nucleophile or leaving group is eliminated. The weaker base is eliminated. Then how do acid chlorides form as OH- is a stronger base than Cl–.
Acid chlorides are normally formed from carboxylic acids by the action of reagents such as thionyl chloride (SOCl2). This is not a SN2 reaction well not at carbon.
Normally a carboxylic oxygen attacks the sulfur of the thionyl chloride displacing an chloride from the thionyl chloride. After loss of a hydrogen ion from the carboxylic acid we will have
A chloride anion then attacks the carbonyl carbon as a nucelophile, the sulfur group acts as a leaving group. It will form sulfur dioxide and another chloride anion. In terms of the reaction at the organic part of the molecule it should be classified as a nucelophilic attack on a carbonyl compound which results in the substitution of one group for another. In terms of mechanism it is very similar to the formation of an ester from an alcohol and a carboxylic acid.
Here is the mechanism