Team innovation is nurtured by the combination of team members’ diverse knowledge and collaborative teamwork. Previous research predominantly assumed a linear interaction between knowledge diversity and network density in predicting team innovation. A pivotal question arises: How do varying levels of knowledge diversity and network density interact to influence team innovation? To address this complex question, we conducted a machine-learning inductive study, leveraging its ability to uncover curvilinear interactive patterns between knowledge diversity and network density in fostering team innovation. We collected comprehensive, multisource data from 1,883 teams within a prominent high-technology firm in China over a four-year period from 2014 to 2017. The results indicate that knowledge diversity and network density exhibit a curvilinear interactive effect on team innovation. The two factors reinforce each other in the initial stage and foster peak innovation with an optimal balance at a medium-to-high level. Beyond this threshold, however, the two factors begin to restrain each other’s effectiveness. Consistent with the perspective of yin-yang balancing, this study deepens our understanding of the paradoxical joint effects of knowledge diversity and network density on team innovation.