Magnetohydrodynamic (MHD) mixed convection in a 3D (three dimensional) lid-driven cavity loaded with a power-law nanofluid is examined. The bottom wavy wall is maintained at a hot temperature, while the upper lid is at a uniformly cold temperature. The vertical walls are kept in adiabatic conditions. The steady and three-dimensional flow of nanofluids is quantitatively studied utilizing thermophysical properties and the Galerkin Finite Element Method (GFEM). The findings were shown for a variety of Grashof numbers (Gr = 103-105), Hartmann numbers (Ha = 0–20), Reynolds numbers (Re = 10–500), power-law indexes (n = 0.8,1,1.6), and undulation numbers (N = 1–4). The influence of the various parameters on flow, heat transfer, and entropy generation is illustrated by the streamlines, isotherms, and isentropic contours. Higher Re, γ, N, φ, and lower Ha enhance the heat transfer. Entropy generation is mostly due to heat transfer but also fluid-friction and magneto effects contribute. Also, the increase in Re from 50 to 500 gives an enhancement in Nuav up to 87.5 %. Furthermore, the increase in power-law index (n) from 0.8 to 1 gives a reduction in Nusselt number up to 10.58 %.