Recently, two-dimensional (2D) metal oxide films with a thickness of one to a few atomic layers have been grown on metal substrates, which are naturally resistant to oxidation and possess highly tunable surface properties. They form a potential family of heterogeneous catalysts for energy conversion. The practical implementation of these heterostructures, however, requires the precise control of their catalytic performance. Here we use 2D magnesium oxide (MgO) overlayers on metal substrates for electrocatalysis of CO2 reduction. By comprehensive first-principles calculations, the effects of the facet and number of layers of MgO sheets, as well as the type and exposed surface of metal substrates on the catalytic behavior of various 2D MgO/metal heterostructures are clearly revealed. Our calculations show that the high activity for CO2 reduction originates from the exotic surface states of MgO overlayers, mediated by their electronic coupling with metal substrates. The key parameters governing the activity and selectivity, including the p-band center of MgO sheets and the work function of 2D MgO/metal heterostructures, are thoroughly analyzed to establish an explicit band structure-Activity relation. These findings provide universal guidelines for engineering the oxide/metal interface with atomic precision and developing durable, cost-effective and environment-benign catalysts made of p-block elements for various energy applications.