Associations between obesity and physical inactivity are bi-directional. Both are associated with physical functioning (PF, ability to perform physical tasks of daily living) but whether obesity influences PF via inactivity is unknown. We investigated whether mid-adult obesity trajectories were associated with subsequent PF and mediated by inactivity. Body mass index (BMI; kg/m²) and inactivity were recorded at: 36, 43, 53 and 60-64 years in the 1946 Medical Research Council (MRC) National Survey of Health and Development (1946-NSHD; n = 2427), and at 33, 42 and 50 years in the 1958 National Child Development Study (1958-NCDS; n = 8674). Poor PF was defined as the lowest (gender and cohort-specific) 10% on the Short-form 36 Physical Component Summary subscale at 60-64 years (1946-NSHD) and 50 years (1958-NCDS). Estimated randomized-interventional-analogue natural direct (rNDE) and indirect (rNIE) effects of obesity trajectories on PF via inactivity are expressed as risk ratios [overall total effect (rTE) is rNDE multiplied by rNIE]. In both cohorts, most individuals (∼68%) were never obese in adulthood, 16-30% became obese and ≤11% were always obese. In 1946-NSHD, rTE of incident obesity at 43 years (vs never) on poor PF was 2.32 (1.13, 3.51); at 53 years it was 1.53 (0.91, 2.15). rNIEs via inactivity were 1.02 (0.97, 1.07) and 1.02 (0.99, 1.04), respectively. Estimated rTE of persistent obesity from 36 years was 2.91 (1.14, 4.69), with rNIE of 1.03 (0.96, 1.10). In 1958-NCDS, patterns of association were similar, albeit weaker. Longer duration of obesity was associated with increased risk of poor PF. Inactivity played a small mediating role. Findings reinforce the importance of preventing and delaying obesity onset to protect against poor PF. © The Author(s) 2020. Published by Oxford University Press on behalf of the International Epidemiological Association.