Background The role of environmental exposures in chronic obstructive pulmonary disease (COPD) remains inconclusive. We examined the association between environmental exposures (PM2·5, greenness, and urbanicity) and COPD prevalence using the UK Biobank cohort data to identify key built environment correlates of COPD. Methods In this cross-sectional, observational study we used baseline data for UK Biobank participants. Included participants were aged 39 years and older, white, had available spirometry data, and had complete data for phenotypes and exposures. COPD was defined by spirometry with the 2017 Global Initiative for Chronic Obstructive Lung Disease criteria. Environmental exposures were PM2·5 derived from monitoring data and interpolated using land-use regression at the participants' geocoded residential addresses. Built environment metrics of residential greenness were modelled in terms of normalised difference vegetation index from remotely sensed colour infrared data within a 500 m residential catchment, and an urbanicity index derived from spatial analyses and measured with a 1 km buffer around each participant's residential address. Logistic regression models examined the associations between environmental exposures and COPD prevalence adjusting for a range of confounders. Subgroup analyses by urbanicity and effect modification by white blood cell count as an inflammatory marker were also done. Findings We assessed 96 779 participants recruited between April 4, 2006, and Oct 1, 2010, of which 5391 participants had COPD with a prevalence of 5·6%. Each 10 μg/m3 increment in ambient PM2·5 exposure at a participant's residential location was associated with higher odds of COPD (odds ratio 1·55, 95% CI 1·14–2·10). Among the built environment metrics, urbanicity was associated with higher odds of COPD (1·05, 1·01–1·08 per interquartile increment), whereas residential greenness was protective, being associated with lower odds of COPD (0·89, 0·84–0·93 for each interquartile increment in greenness). The results remained consistent in models of COPD defined as per lower limit of normal criteria. The highest quartile of white blood cell count was associated with lower lung function and higher COPD risk with a significant interaction between PM2·5 and white blood cell count only in the model of lung function (p=0·0003). Interpretation In this study of the built environment and COPD, to our knowledge the largest done in the UK, we found that exposure to ambient PM2·5 and urbanicity were associated with a higher risk of COPD. Residing in greener areas, as measured by normalised difference vegetation index, was associated with lower odds of COPD, suggesting the potential value of urban planning and design in minimising or offsetting environmental risks for the prevention and management of COPD. Funding University of Hong Kong, UK Biobank, and UK Economic & Social Research Council.