Nanofilters made with high adsorption freeze-dried modified cellulose nanofiber (CNF) aerogel were produced. The modification was made using functional groups containing phthalimide, and then their ability to adsorb particulate matter (PM) was evaluated and compared with the control filter (HEPA). The results showed that the highest adsorption of PM2.5 (99.95%) belonged to the nanofilters made of 1.5% phthalimide-modified CNF aerogel, and the lowest adsorption (76.66%) was related to the control samples. Moreover, based on the results, the nanofilter produced from freeze-dried phthalimide-modified CNF aerogel showed high filtration efficiency as well as excellent resistance to temperature and humidity. This modification enables the filter to operate in different environmental conditions, especially for particles less than 0.1 μm that are mainly responsible for reducing air quality, human health, air visibility, and climate change. In conclusion, we developed an environmentally friendly biodegradable nanofilter capable of high-performance filtration functions and structural stability in different environmental conditions.