The online gaming industry increasingly incorporates virtual agents to enhance player experiences. Although prior literature has explored the provision of virtual agents in gaming, research on technological advancements remains limited. In this study, we investigate how introducing artificial intelligence (AI) powered agents as virtual opponents (versus rule-based opponents) influences human players’ engagement and performance. Leveraging a large-scale quasi-field experiment in a multiplayer online racing game, we employ difference-in-differences analyses with matching strategies and show that, on average, the introduction of AI opponents can have ‘discouragement effects’ on players, resulting in reduced player engagement and decreased performance. Our research also identifies differential long-term impacts of AI opponents on engagement and performance. In addition, our mechanism exploration reveals that introducing AI opponents increases competition intensity and immersion in the game, and these two factors exhibit opposing influences on players’ subsequent behavior. Specifically, heightened competition hinders players’ further engagement and performance progression, whereas a more immersive experience encourages more gaming participation and better performance. Further, we find the effects of AI opponents on player engagement and performance vary by player motivation and skill levels, such that competition-oriented and highly skilled players are more receptive to AI opponents. Moreover, our findings indicate that optimal engagement and performance outcomes occur when players compete against opponents with comparable and low competence levels, respectively. Lastly, we observe an inverted U-shaped relationship between the proportion of AI opponents and players’ engagement and performance, wherein both insufficient and excessive exposure to AI opponents lead to diminishing outcomes. Our study contributes to the literature on human-AI interactions by offering novel empirical evidence on the impact of AI opponents on human players’ experiential and instrumental outcomes and disentangling the underlying mechanisms. This work also offers practical implications for game designers and policymakers regarding the design of AI-integrated competitive environments.