In recent years, correlated insulating states, unconventional superconductivity, and topologically non-trivial phases have all been observed in several moiré heterostructures. However, understanding of the physical mechanisms behind these phenomena is hampered by the lack of local electronic structure data. Here, we use scanning tunnelling microscopy and spectroscopy to demonstrate how the interplay between correlation, topology, and local atomic structure determines the behaviour of electron-doped twisted monolayer–bilayer graphene. Through gate- and magnetic field-dependent measurements, we observe local spectroscopic signatures indicating a quantum anomalous Hall insulating state with a total Chern number of ±2 at a doping level of three electrons per moiré unit cell. We show that the sign of the Chern number and associated magnetism can be electrostatically switched only over a limited range of twist angle and sample hetero-strain values. This results from a competition between the orbital magnetization of filled bulk bands and chiral edge states, which is sensitive to strain-induced distortions in the moiré superlattice.