The study of mixed convection heat transfer within rectangular cavities is a vital topic in engineering applications such as ventilation systems and heat exchangers. In this research, ANSYS Fluent software was used to simulate heat transfer within a rectangular cavity. The left wall was heated, and the right wall was cooled; the aspect ratio (AR) was varied (0.5-2), and an inlet was installed at the top and an outlet at the bottom, while the other walls were insulated. The Reynolds number (Re) values ranged from (4000 to 22000), and the Richardson number (Ri) ranged from (10 to 1200). The results showed that the Nusselt number increased with increasing Re and decreased with Ri, reaching a maximum of 185.3 at AR = 0.5 and Re = 21312, while the highest thermal efficiency of 0.284 was recorded at AR = 1 and Re = 4736. The flow and temperature contour also revealed that AR = 1 provides an optimal balance between heat transfer enhancement and flow stability, making this ratio most suitable for the design of a highly efficient thermal system.