The present numerical work is performed to analyze the heat transfer and fluid flow due to free convection in a porous equilateral triangular enclosure with a heated square body in the presence of magnetic field and heat generation. The left inclined wall of the enclosure is adiabatic while the horizontal wall is heated at a uniform temperature; the lower portion of the right inclined wall is considered to be nonisothermal and the upper portion of the wall is cold. The square body is maintained at a constant temperature. The governing equations are solved numerically subject to appropriate boundary conditions by the finite element method using Galerkin's weighted residuals scheme. Results are presented by streamlines, isotherms, mean Nusselt numbers for the different parameters such as Hartmann number (Ha), heat generation (λ), and size of the square body (l b). The Prandtl number (Pr) and Rayleigh number (Ra) are considered fixed. It is observed that the size of the body plays an important role with regard to the heat and fluid flow inside the cavity.