Polyene polyketides amphotericin B (AMB) and nystatin (NYS) are important antifungal drugs. Thioesterases (TEs), located at the last module of PKS, control the release of polyketides by cyclization or hydrolysis. Intrigued by the tiny structural difference between AMB and NYS, as well as the high sequence identity between AMB TE and NYS TE, we constructed four systems to study the structural characteristics, catalytic mechanism, and product release of AMB TE and NYS TE with combined MD simulations and QM/MM calculations. The results indicated that compared with AMB TE, NYS TE shows higher specificity on its natural substrate and R26 as well as D186 were proposed to a key role in substrate recognition. The energy barrier of macrocyclization in AMB-TE-Amb and AMB-TE-Nys systems were calculated to be 14.0 and 22.7 kcal/mol, while in NYS-TE-Nys and NYS-TE-Amb systems, their energy barriers were 17.5 and 25.7 kcal/mol, suggesting the cyclization with their natural substrates were more favorable than that with exchanged substrates. At last, the binding free energy obtained with the MM-PBSA.py program suggested that it was easier for natural products to leave TE enzymes after cyclization. And key residues to the departure of polyketide product from the active site were highlighted. We provided a catalytic overview of AMB TE and NYS TE including substrate recognition, catalytic mechanism and product release. These will improve the comprehension of polyene polyketide TEs and benefit for broadening the substrate flexibility of polyketide TEs.