Anxiety and depression are common mental illnesses among nurses fighting coronavirus disease 2019 (COVID‐19). However, the precise factors that affect anxiety and depression in this population require further evaluation. This study aimed to explore factors associated with anxiety and depression among nurses fighting COVID‐19 in China. We used convenience sampling to recruit 282 nurses fighting COVID‐19 in three hospitals. Participants were questioned about demographic characteristics, daily working time, daily sleep duration, sleep quality, anxiety, depression, resilience, and coping styles. Linear regression analysis indicated that resilience (β = −0.217, P < 0.001), positive coping style (β = −0.281, P < 0.001), negative coping style (β = 0.395, P < 0.001), and sleep quality (β = 0.153, P = 0.010) were predictive factors for anxiety, and the model explained 44.20% (P < 0.001) of variability. Resilience (β = −0.239, P < 0.001), positive coping style (β = −0.222, P < 0.001), negative coping style (β = 0.152, P < 0.001), and sleep quality (β = 0.104, P = 0.003) were identified as explanatory factors for depression, and the model explained 34.50% (P < 0.001) of variability. The present study suggested that resilience, coping styles, and sleep quality could account for an individual’s levels of anxiety and depression.