• Heat transfer models on thermal engines for TUG are built and verified. • Performance of thermal engine are optimized based on the models. • A piston-type configuration is proposed for thermal engine. Thermal underwater glider (TUG) harvests the ocean thermal energy and glides for a few thousands of kilometers range in a self-propelled manner. Theoretical models on the ocean thermal energy conversion process have been well established for evaluating the conversion efficiency. However, the heat transfer process is rarely modeled for TUG, leading to an inadequate quantification on the output power. In this work, comprehensive theoretical models with both energy conversion and heat transfer processes are conducted on a piston type TUG. The models well predict the performance of the thermal engine as compared with the reported experimental data. The effects of the surface seawater temperature, nitrogen gas volume, nitrogen gas pressure, phase change material (PCM) volume, seawater velocity as well as the gliding angle on the performance of the thermal engine are discussed. The results show that the the effective output power of the nitrogen tank varies from 0.4 to 1.0 W when 4 L PCM is employed in the thermal engine. A lower initial nitrogen volume (1.0 to 0.6 L), larger initial nitrogen pressure (1.0 to 5.0 MPa), larger PCM volume (2.0 to 5.0 L), greater seawater velocity (0–3 m/s) and larger gliding angle (20° to 90°) is beneficial for the improvement of the energy conversion efficiency and output power of the thermal engine. This proposed theoretical models are essential for optimizing the design and operating parameters of thermal engine of a TUG.