Biodiesel is a non-toxic and environmentally friendly fuel that is made from renewable biological sources. It can replace petrochemical diesel and has very broad application prospects. However, the main raw materials in biodiesel are animal and plant oils, which present the problems of high costs and a lack of resources. The current research primarily emphasizes the transesterification process, with comparatively less focus on the esterification of fatty acids. In this paper, a series of phosphotungstic acid (PTA)-functionalized hydrophobic MCM–41 catalysts, OTS–PTA–MCM–41(Cx), were synthesized and used to catalyze the esterification of long-chain fatty acids with methanol in water. The experimental results show that the yield of esterification reached a maximum when catalyzed by OTS–PTA–MCM–41(Cx) and synthesized with a template agent with two carbon atoms less than the number of carbon atoms of a fatty acid. The effects of different reaction variables were investigated to optimize the reaction conditions for the maximum conversion. The stability of the catalyst was also verified. Finally, a mixed catalyst was used to catalyze in situ the esterification of fatty acids in a fermentation broth, which reached a high level (close to 90%). This paper provides references for the synthesis of a hydrophobic solid acid catalyst and green synthesis by esterification reactions in an aqueous solution and a fermentation broth system.