Increasing hospital admissions for pneumonia have been reported recently but it is not known whether pneumonia incidence rates have increased in the community. To determine whether incidence rates of pneumonia increased in primary care in the United Kingdom from 2002 to 2017, an open cohort study was conducted using electronic health records from the UK Clinical Practice Research Datalink. Clinically diagnosed pneumonia, influenza pneumonia, pleural infection and clinically suspected pneumonia, defined as chest infection treated with antibiotics, were evaluated. Age-standardised and age-specific rates were estimated. Joinpoint regression models were fitted and annual percentage changes (APC) were estimated. There were 70.7 million person-years of follow-up with 120 662 episodes of clinically diagnosed pneumonia, 1 831 005 of clinically suspected pneumonia, 23 814 episodes of influenza pneumonia and 2644 pleural infections over 16 years. The incidence of clinically diagnosed pneumonia increased from 1.50 per 1000 person-years in 2002 to 2.22 per 1000 in 2017. From 2010 to 2017, the APC in age-standardised incidence was 5.1% (95% confidence interval 3.4–6.9) compared with 0.3% (−0.6 to 1.2%) before 2010. Clinically suspected pneumonia incidence rates increased from 2002 to 2008 with an APC 3.8% (0.8–6.9) but decreased with an APC −4.9% (−6.7 to −3.1) from 2009 to 2017. Influenza pneumonia increased in the epidemic year of 2009. There was no overall trend in pleural infection. The results show that clinically diagnosed pneumonia has increased in primary care but there was a contemporaneous decline in recording of clinically suspected pneumonia or ‘chest infection’. Changes in disease labelling practice might partly account for these trends.