Fundamental understanding of interfacial magnetic properties in ferromagnetic heterostructures is essential to utilize ferromagnetic materials for spintronic device applications. In this paper, we investigate the interfacial magnetic and electronic structures of epitaxial single-crystalline LaAlO$_3$ (LAO)/La$_{0.6}$Sr$_{0.4}$MnO$_3$ (LSMO)/Nb:SrTiO$_3$ (Nb:STO) heterostructures with varying LSMO-layer thickness, in which the magnetic anisotropy strongly changes depending on the LSMO thickness due to the delicate balance between the strains originating from both the Nb:STO and LAO layers, using x-ray magnetic circular dichroism (XMCD) and photoemission spectroscopy (PES). We successfully detect the clear change of the magnetic behavior of the Mn ions concomitant with the thickness-dependent metal-insulator transition (MIT). Our results suggest that double-exchange interaction induces the ferromagnetism in the metallic LSMO film under tensile strain caused by the SrTiO$_3$ substrate, while superexchange interaction determines the magnetic behavior in the insulating LSMO film under compressive strain originating from the top LAO layer. 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 3$d_{3z^2-r^2}$ orbitals under compressive strain and the double-exchange interaction via the 3$d_{x^2-y^2}$ orbitals.