Underground engineering frequently encounters the challenges of high temperatures and high confining pressures. The combined effects of temperature and confining pressure can significantly alter the mechanical properties of rock. Evaluating the impact of these factors on rock is a crucial aspect of engineering. This study investigates the mechanical properties of rocks under various temperature and stress conditions, focusing on the deformation and failure characteristics of four typical rock types: granite, red sandstone, gray sandstone, and shale under temperature-confining pressure coupling. The results indicate that high temperatures cause internal structural damage and crack propagation in rocks, leading to a reduction in compressive strength and elastic modulus. Conversely, high confining pressures can inhibit crack propagation and enhance rock deformation capacity. Additionally, significant differences were observed in the mechanical responses of different rocks; red sandstone and shale predominantly exhibited shear failure under the coupled effects of temperature and confining pressure, whereas granite and gray sandstone exhibited bulging failure. Based on the experimental results, an elastic modulus fitting model considering the temperature-confining pressure coupling effect was proposed, and the parameters of the Drucker–Prager criterion were modified. A constitutive model was constructed to accurately reflect the stress–strain state of rocks under the coupled effects of temperature and confining pressure. The constitutive model results show good agreement with the experimental findings.