Why can't sodium borohydride reduce carboxylic acid and ester groups?
The reason for this is because OH and OR groups are much more electron-donating. Typically, when you have an aldehyde or ketone, the electronegative electron is slightly more negative and thus the carbonyl carbon is more positive. However, with an OH or OR group attached (i.e in carboxylic acid and esters), the group can push electrons towards the carbon since they are electron-donating groups. This makes the carbonyl carbon less positive and less open to nucleophilic attack.