Residential greenness, a fundamental component of urban design, could contribute to the prevention of respiratory infections via several potential mechanisms. However, the health benefits of greenness on influenza epidemics in real world are not as clear. In this cross-sectional, associational study, a series of logistic models were constructed to assess the association between individual-level residential greenness exposure, measured by the normalized difference vegetation index (NDVI), and the risk of influenza virus infection in China via 8 years of influenza surveillance data. From 2010 to 2017, 3,131,881 influenza-like illness (ILI) cases were tested for influenza, and 1,012,430 (32.3%) participants with detailed building-level residential addresses were included in this study. Overall, a protective effect of residential greenness was observed, with 2.6% lower odds of influenza virus infection per one-quartile increase in the NDVI (odds ratio (OR) = 0.974, 95% confidence interval (CI): 0.963-0.985). Stratified analyses indicated that the protective effects of residential greenness were strongest among adults aged ≥60 years (OR = 0.853, 95% CI: 0.814-0.894), but among school-aged children, the association was positive. There were no protective effects at other city scales except in megacities (OR = 0.907, 95% CI: 0.886-0.930). Given the rapid aging and urbanization process in China, policies aimed at optimizing the allocation and design of green spaces might help reduce respiratory infection transmission.