In this paper for the first time, a Lattice Boltzmann Simulation is performed to analyze the simultaneous effects of a hot rotating elliptic cylinder and the magnetic field on the mixed convection flow in a square enclosure. Complicated flow patterns and isotherm plots are found and analyzed in the concentric annulus between the internal elliptic cylinder and the outer square enclosure. Results indicate that increasing the Reynolds number, instantaneous averaged Nusselt number of the enclosure and its oscillation amplitude increase, while decrease with increasing the Hartmann number especially at its lower values. Furthermore, response surface method is adopted to find the optimal location of the elliptic cylinder. Response surface optimization results reveal that the average Nusselt number shows a decreasing–increasing trend with increasing both nondimensional parameters of cylinder center (Xc, Yc). Finally, the optimal location of the elliptic cylinder for the maximum heat transfer rate is obtained as Xc = 0.65 and Yc = 0.35. Moreover, a comparative study is performed to evaluate the heat transfer effects of the elliptical cylinder rotation as compared to circular cylinder. It was found that the elliptical cylinder rotation has a significant effect on the heat transfer enhancement, especially at high values of Re and Ha. As an example, the heat transfer rate for the elliptical cylinder at Re = 200 is increased by 13% and 34% as compared to the circular cylinder at Ha = 50 and 100, respectively.