This study aims to investigate the magnetoconvection of an electrically conducting fluid within a rectangular enclosure through a comprehensive three-dimensional computational analysis. The enclosure has a hemispherical block for bottom heating and incorporates two elliptical sources with differing temperatures along its vertical sidewalls. The primary focus is to optimize heat transfer and fluid flow characteristics within this thermal system by analyzing various control parameters. The simulations were carried out with the relevant parameters of the problem, including the Rayleigh number [Formula: see text], Hartmann number [Formula: see text], the inclination of the magnetic field [Formula: see text], and the radius of the hemispherical block [Formula: see text]. Three distinct scenarios represent different positions for the localized heat sources. Among these configurations, the Middle–Middle (MM) arrangement is the most favorable, with the specific value for the radius [Formula: see text] yet to be determined. The findings highlight the effective control of heat transfer rate and irreversibility effects by manipulating the parameters [Formula: see text], [Formula: see text] and [Formula: see text]. It is demonstrated that selecting [Formula: see text] and [Formula: see text] values of [Formula: see text] and 15 allows for optimal thermal system configuration. A correlation with two variables [Formula: see text] expressing the rate of heat transfer through the cavity was established and verified. The analysis of the helicity confirms the predicted optimal case.