In the reaction with p-aminophenol & acetic anhydride (under an acidic environment), one of the C=O bonds gets protonated in acetic anhydride leaving a carbocation and an R-OH. This is how I learned this mechanism when making aspirin (O-Acylation). In this diagram, it shows Nitrogen attacking the sp2 hybridized (s+) carbon, which is slightly different than what I described. It looks more like an Sn2 reaction in this image. Is it safe to say both mechanisms happen in solution?
Anyways, thats not really my question
The mechanism is called N-acylation. I understand how this mechanism proceeds, but I do not understand why Nitrogen acts as the nucleophile rather than the O from the R-OH on the benzene ring. R-OH has two lone pairs and is Sp3 hybridized. Meanwhile, The amine group has one electron pair, but I would say it is sp2 hybridized. The reason I say this, is because the lone electron pair must be delocalized from its orbital by the benzene ring next to it. Won't this make Nitrogen an even weaker base/nucleophile?
The oxygen has 2 Sp3 hybridized lone pairs. What factors should I be comparing to decide which will act as a better nucleophile? Oxygen has a higher electron density. But it also is more electro negative, so it wants to hold on to those electron pairs. Its also more polarizable.
Nitrogen is less electronegative, and is more willing to attack an electrophile with its lone pairs....but its lone pair is already pretty delocalized by the benzene ring.
What am I missing? Thank you!