Knowledge sharing is influenced not only by the attributes of the knowledge itself and the hierarchical differences among knowledge holders but also by micro-level factors such as interpersonal communication and psychological dynamics. As the demands of the new economic environment evolve, the role of knowledge sharing among team members in knowledge management has become increasingly critical. A growing body of research emphasizes the importance of sharing knowledge resources as a means of gaining strategic advantages in enterprises. Previous studies have shown that leadership behavior plays a crucial role in fostering knowledge sharing among team members. However, there is limited research on the specific pathways and mechanisms through which leadership behavior influences knowledge sharing. Additionally, existing research lacks a comprehensive examination of the structure and measurement methods of leader–member exchange (LMX), as well as its impact on employee work outcomes. This study addresses this gap by examining trust relationships through the lenses of social identity and emotional interaction, with trust serving as a mediating variable to explore the impact of leader–subordinate interactions on knowledge sharing behavior. Drawing on the relevant literature, the study focuses on 358 employees, investigating the relationship between LMX as the independent variable, team knowledge sharing as the dependent variable, and employee trust as the mediating factor. The research findings are as follows: (1) The quality of the LMX relationship significantly influences employees’ team knowledge sharing; higher-quality LMX relationships are associated with increased knowledge sharing among subordinates. (2) Employee trust in both leaders and colleagues has a substantial impact on team knowledge sharing, with higher levels of trust positively affecting knowledge sharing behaviors. (3) Employee trust serves as a mediating factor in the relationship between LMX and team knowledge sharing. This study delves into the dynamics between LMX, team knowledge sharing, and trust, providing practical recommendations for strengthening these relationships.