A numerical investigation has been performed to visualize the natural convective heat transfer and nature of entropy generation from a heated cylinder of two separate geometries (circular and square) situated within a square enclosure subjected to non-uniform temperature distributions on the left vertical and bottom walls. The flow inside the enclosure is steady, incompressible and laminar and the working fluid is Newtonian with constant Prandtl number (Pr = 0.71). The results are discussed in terms of the distribution of streamlines and isotherms, surface-averaged Nusselt number and entropy generation, for a different combination of Rayleigh number (103 to 106) and dimensionless wavelength of sinusoidal temperature distribution ( $$0.1 \le \lambda \le 0.7$$ ). It reveals that sinusoidal temperature with higher wavelength enhances the heat transfer. Moreover, the highest value of Nusselt number is obtained in case of enclosure embraces the circular cylinder. Further, the thermal entropy generation is observed to be minimum for sinusoidal temperature distribution with a wavelength of 0.7 irrespective of Rayleigh number. In addition to this, the geometrical configuration of the cylinder has a negligible effect on the variation of fluid friction and thermal irreversibility at higher Rayleigh number. Finally, the circular shape of the embedded cylinder is found to be optimal since it results in maximum heat transfer with least entropy generation.