Only a few studies have assessed the effects of fine particulate matter (PM2.5) exposure during the prenatal and postnatal periods on the development of attention-deficit/hyperactivity disorder (ADHD). We investigated the association of exposure to PM2.5 during pregnancy and early life with ADHD. This birth cohort consisted of 425,736 singleton live-term births between 2004 and 2015 in Taiwan. Daily PM2.5 concentrations were derived from a 1-km satellite-based estimation model. A time-dependent Cox model was used to assess the effects of PM2.5 on ADHD during the first, second, and third trimesters and from age 1–5 years after birth. The distributed lag nonlinear model was utilized to explore the dose–response relationship. Total 9,294 children were diagnosed with ADHD during the study period. The hazard ratio (HR) of ADHD was significantly associated with a 10 μg/m3 increase in PM2.5 during the first trimester (HR = 1.26; 95% confidence interval [CI]: 1.13–1.40) and increased at PM2.5 over 16 μg/m3. For postnatal periods, the HR of ADHD was significantly associated with increased PM2.5 at the first to third year of life (HR ranged between 1.40 and 1.87). According to the dose-response relationship of exposure to PM2.5 at the third year of life, the HR of ADHD was significantly associated with PM2.5 above 16 μg/m3 and sharply increased as PM2.5 >50 μg/m3. We did not observe a significant modification of sex on the relation between PM2.5 and ADHD. Exposure of pregnant women to PM2.5 above 16 μg/m3 from conception to the early life of their children may increase the risk of ADHD. The government should improve the criteria for air quality control and meet the WHO air quality guidelines to protect pregnant women and children from developing ADHD in the future.