This study addresses a critical gap in educational technology research by simultaneously examining the internal and external determinants of Artificial Intelligence (AI) integration in primary mathematics instruction. Using a second-order Structural Equation Modeling (SEM) framework, the study investigates how teachers’ attitudes and TPACK competencies (internal factors), alongside policy support, infrastructure, and community engagement (external factors), influence AI utilization among 516 primary school mathematics teachers in Jakarta, Indonesia. The results reveal that internal factors have a strong direct effect on AI utilization (β = 0.791; p < 0.001), while external factors exert a significant indirect influence via internal mediators (β = 0.217; p < 0.001), despite an insignificant direct effect (β = 0.008; p = 0.908). The model explains 78.1% of the variance in AI utilization (R² = 0.781) and shows high predictive relevance (Q² > 0.70). These findings underscore the pivotal role of teacher readiness in AI integration, with systemic support enhancing its effectiveness through internal capacity-building. The study contributes an empirically validated instrument and a comprehensive ecological model, offering actionable insights for policymakers and educators in developing nations pursuing ethical, equitable, and sustainable AI integration in primary education.