In the present work, a numerical study is carried out to investigate, with the aid of the lattice Bolkmann method (LBM), the natural convection air (Pr = 0.71) cooling of an electronic component presented as a heat source attached to the bottom wall of a rectangular cavity. The top wall is isothermal and other walls are adiabatic. In order to optimize the ability of the heat sink to reject more heat from the heat source and ensure an effective cooling of the electronic component, a series of numerical simulations are conducted by varying the cold wall position (top - right), inclination angle (0° ≤ γ ≤ 90°), the aspect ratio of the cavity (0.25 ≤ A ≤ 1.5), and the heat source position (ε = 0.25, ε = 0.35, and ε = 0.5), while the Rayleigh number is kept constant, Ra = 106. Results show that the cavity structure has a deep impact on the cooling of the electronic component. The aspect ratio A = 1.5 ensures a relatively excellent heat transfer rate when the cavity is cooled by the top wall. The heat source position within the cavity has, also, a noticeable impact on dynamic and thermal fields. Indeed, it was found that the local Nusselt number of the cold wall and heat source indicate that, by varying the position of the heat source, fluid flow and natural convection rate are more important in the right cavity compared to the left one.