Professional identity is essential for a qualified teacher; however, the imbalance between job resources and demands is a serious impediment to promoting teachers’ professional identity. Given that personal job resources (i.e., teachers’ socioemotional competence and psychological capital) and challenging job demands (homeroom/non‐homeroom teachers) are distinctive—but understudied—job characteristics, this study examines their role in fostering teachers’ professional identity, based on the Job Demands‐Resources (JD‐R) model. Data from 432 secondary school teachers in Henan Province, China were collected using the Chinese versions of the Teacher Socioemotional Competence Scale, Psychological Capital Scale, and Teacher Professional Identity Scale. The results showed that teachers’ socioemotional competence positively predicted their professional identity. The moderating mediator analysis showed that the mediating role of psychological capital and the moderating role of being a homeroom or non‐homeroom teacher contributed immensely to teachers’ professional identity. The identification of this moderated mediation model broadens our understanding of the JD‐R model by demonstrating the interplay between personal job resources and challenging job demands. This study also emphasizes the imperative for optimizing the balance between “demands” and “resources” to enhance teachers’ professional identity, and proposes effective interventions.