The relative occurrence of infection in patients treated with cytotoxic chemotherapeutic drugs and molecularly targeted drugs is unclear. To compare the occurrence of respiratory and urinary tract infections in patients treated for lung cancer with docetaxel versus afatinib and to predict the occurrence of the respiratory and urinary tract infections. Data on patients who received docetaxel or afatinib were obtained from a health insurance claims database. After propensity score matching, the occurrence of respiratory and urinary tract infections in each group was compared. Factors associated with respiratory and urinary tract infections were evaluated using multivariable conditional logistic regression analysis. Each group included 855 patients. The occurrence of respiratory infections was significantly higher in the docetaxel group than in the afatinib group (22.6% [193/855] vs. 13.9% [119/855]; p < 0.01). The occurrence of urinary tract infections did not differ significantly by group. Docetaxel was independently associated with a significantly increased risk of respiratory infections (adjusted odds ratio: 1.68, 95% confidence interval: 1.23-2.29), but not urinary tract infections. Patients with lung cancer treated with docetaxel should be closely monitored for the occurrence of respiratory infection in clinical settings.