Many urban deep-decarbonization actions are related to multiple infrastructure provisioning sectors; therefore, it is essential to track carbon footprints associated with these infrastructure sectors to guide urban carbon mitigation actions. However, there are fewer temporal analyses of cities' carbon footprints from a multi-infrastructure perspective. This study applied the community-wide trans-boundary infrastructure-based carbon footprinting (CIF) method to Shanghai, China and adopted the logarithmic mean Divisia index (LMDI) approach to explore driving factors in community-wide carbon footprints from 2000 to 2019. Shanghai's total CIF increased by 85%, from 153.2 million tonne CO2-eq in 2000 to 283.5 million tonne in 2019. The energy and mobility sectors contributed to 89%–93% of the total CIF during this period. Although emitting sources within Shanghai contributed to a large proportion, trans-boundary carbon emissions embodied in imported energy, construction materials, and food provisioning increased from 6% of total CIF in 2000 to 28% in 2019. Shanghai significantly reduced city-wide carbon intensity per GDP from 2000 to 2019. Its city-wide carbon footprint per capita was around 11.4 tonne CO2-eq, of which 17.4% was associated with residential consumption. LMDI results showed that improving energy efficiency in economic production and reducing energy demand in residential sector contributed to reducing carbon footprints of these two sectors. The driving effect of carbon intensity was not monotonic in both economic production and residential consumption, indicating future policy should prioritize actions to reduce the carbon intensity of infrastructure provisioning in its carbon neutrality plan.