A fundamental understanding of the interfacial magnetic properties in ferromagnetic heterostructures is essential for utilizing ferromagnetic materials for spintronic device applications. Here, we investigate the interfacial magnetic and electronic structures of epitaxial single-crystalline LaAlO3(LAO)/La0.6Sr0.4MnO3(LSMO)/Nb:SrTiO3(Nb:STO) heterostructures with varying LSMO layer thicknesses, in which the magnetic anisotropy strongly changes with the LSMO thickness due to the delicate balance between strains originating from both the Nb:STO and LAO layers, using x-ray magnetic circular dichroism and photoemission spectroscopy. We successfully detect the clear change of the magnetic behavior of the Mn ions concomitant with the thickness-dependent metal-insulator transition. Our results suggest that the double-exchange interaction induces ferromagnetism in the metallic LSMO film under tensile strain caused by the STO substrate, while the superexchange interaction determines the magnetic behavior in the insulating LSMO film under compressive strain originating from the top LAO layer. The change in strain, depending on LSMO layer thickness, is confirmed by scanning transmission electron microscopy. Based on those findings, the formation of a magnetic dead layer near the LAO/LSMO interface is attributed to competition between the superexchange interaction via Mn 3d3z2-r2 orbitals under compressive strain and the double-exchange interaction via the 3dx2-y2 orbitals. These findings provide key aspects of ferromagnetic oxide heterostructures for the development of spintronic device applications.