Artificial intelligence (AI) is revolutionizing the way firms pursue technological diversification (TD), yet its distinct effects on related and unrelated diversification remain insufficiently explored. Based on the knowledge-based view, this study examines the distinct effects of AI on related and unrelated TD to elucidate AI’s specific role in facilitating both the optimization of existing knowledge and the exploration of new domains. Using a multi-period difference-in-differences model and panel data from China’s listed manufacturing firms (2013–2022), our empirical analysis demonstrates that AI significantly promotes firm TD, particularly in unrelated TD. Additionally, we identify that core-technology competence strengthens the positive effect of AI on unrelated TD, while knowledge stocks weaken it. These results contribute to the literature on TD by underscoring the role of AI. Practically, the study offers actionable insights for managers to harness AI in balancing exploration and exploitation within their TD strategies.