To explore the relationships between L2 grit, classroom environment, and willingness to communicate (WTC) in a second language (L2), as well as the mediating role of foreign language classroom emotions (enjoyment, anxiety, and boredom), this study conducted a questionnaire survey using convenience sampling with 198 high school students aged 15 to 19. The results revealed the following: (1) L2 grit, classroom environment, foreign language classroom enjoyment, and L2 WTC were significantly positively correlated, while foreign language classroom anxiety and boredom were significantly negatively correlated with L2 WTC; (2) L2 grit and classroom environment positively predicted L2 WTC; (3) foreign language classroom enjoyment served as a positive partial mediator in the relationships between L2 grit, classroom environment, and L2 WTC. Conversely, foreign language classroom anxiety and boredom acted as negative partial mediators in the relationship between classroom environment and L2 WTC. Therefore, L2 grit and classroom emotions not only directly influence high school students’ L2 WTC but also indirectly affect it by shaping their foreign language classroom emotions.