In the present paper, free heat convection and entropy generation of Newtonian and two types of non-Newtonian fluids, shear-thickening and shear-thinning, inside an L-shaped cavity subjected to a magnetic field have been investigated by the finite difference lattice Boltzmann method. The power-law model was used for modeling the rheology of the fluids. The bottom and left walls of the cavity have been kept at a uniform high temperature. Internal walls are also kept cold. The remaining walls have been insulated against heat and mass transfer. The Boussinesq approximation is used to take the temperature dependency of density into account. The distribution functions of energy and density are modeled through the use of the nine-velocity two-dimensional scheme. The effects of Hartmann number (Ha), aspect ratio, power-law index, and Rayleigh number (Ra), on the flow field, temperature distribution, and entropy distributions are studied. The results show that the magnetic field and the power-law index have an ever-decreasing effect on the heat transfer rate and the entropy generation, while the Ra number has an ever-increasing effect. The maximum heat transfer enhancement of 71% happens at the lowest and the highest values of power-law index and Ra number, respectively, for the case with no magnetic field. The maximum heat transfer deterioration of 77% happens at the highest and lowest values of power-law index and Ra number, respectively, in the presence of the highest magnetic field strength. It is interesting that the sensitivities of heat transfer rate and the entropy generation to the Ha number become significant for shear-thinning fluids. It is found that there is an everlasting interplay between conduction and convection contributions to the irreversibilities, so that, for the Newtonian and shear-thinning fluids, thermal irreversibilities, characterized by Be number, increase with Ha number, reaching to a maximum, and then decline. The heat transfer rate and the tot