The goal of this study is to examine the result of natural convection, magnetohydrodynamics, and nanofluids within a square cavity with an obstacle of a right-angle triangle within it. Among the various nanoparticles, TiO2 nanoparticles blended with water have shown promise in improving heat transfer. The Finite Element Method is used for the simulation. By utilizing the commercial software 'COMSOL Multiphysics 6.1' graphical illustrations, the influence of prominent parameters on streamline, isotherm contours and the local Nusselt number is effectively portrayed. The key factors that play a dominant role include the Prandtl number (Pr = 6.2) and Rayleigh number (104 <= Ra <= 106), Hartmann number (Ha = 0, 30, 50), and the heat source/sink (Q = -6, 0, 6) employed. The result confirms that the decline in fluid velocity and convective heat transfer is due to the enhancement of the Lorentz force. This outcome of the study affirms that the appropriate amalgamation of nanoparticles significantly improves the transmission of heat properties of fundamental fluids. The discoveries of this investigation could aid in comprehending the hydrothermal aspects of thermal systems, including electronic cooling, solar power and the utilization of nanofluid to regulate liquid movement and thermal exchange attributes within the annular space.