Magnetic field effects are encountered in many engineering applications which include but are not limited to metal casting, nuclear reactor coolers, and geothermal energy extraction. On the other hand, due to their outstanding thermal performance, nanofluids have been successful in obtaining acceptability as per the new generation of heat transfer fluids in automotive cooling devices, in heat exchangers, and building heating. Therefore, this research is carried out to understand how the nanofluid flow in a cavity is affected by a magnetic field (due to a dipole placed nearby). The single-phase model is employed for modeling the nanofluid, whereas the governing partial differential equations are solved numerically. The dipole may give rise to the new vortices in the flow near its location while enhancing Nusselt number. The Reynolds number reduces Nusselt number along the lower wall while affecting the strength of vortices near the dipole location. Increasing the strength of the dipole results in distorting the symmetry of streamlines by first enhancing the size of the lower vortex; some vortices near dipole also join and merge. Further, the magnetic field makes the temperature field nonsymmetric and shifts the zone of higher temperature gradient around the location of a dipole. The presence of dipole is more effective for skin friction compared with the Nusselt number.