Enhancing heat transfer rates within enclosures is a topic of considerable interest since it has several technical applications. Most heat transfer research projects focus on increasing the heat transfer rates of thermal systems since this will raise the systems' total efficiency. The geometry of the enclosure might have a substantial impact on heat transfer rates. This research studies quantitatively the natural convection of a nanofluid in a complicated form geometry with many baffle configurations. The system's governing equations were addressed by the Galerkin Finite Element Method (GFEM). The main consideration was given to the effects of the following factors: The Darcy number (Da), which ranges from 10–2 to 10–5; the Hartmann number (Ha), which ranges from 0 to 100; the volumetric fraction (ϕ), which ranges from 0 to 0.08, and the Rayleigh number (Ra) (102 to 106). The results suggested that raising Ra increases heat transfer discharge, whereas raising Ha and Da decreases it. In terms of heat transmission, case 1 (the case with a wavenumber of 1 and the zigzag pointing outward) is determined to be the optimum cavity structure, as it obtained the highest mean Nusselt (Nuavg) number when compared to other cases. At the highest studied Ra number, growing (ϕ) from 0 to 0.8 improved Nuavg by 25%, while growing Da from 10–2 to 10–5 and Ha from 0 to 100 declined Nuavg by 57% and 48%, respectively. The reason for the improvement in the values of the (Nu) is due to the speed of fluid movement within the compartment. Also, the shape of fins plays a major role in strengthening and weakening thermal activity.