Discovery learning is a learning process aimed at uncovering new knowledge through teaching and learning activities. This study investigates the effect of discovery learning in mathematics on computational thinking, considering students' self-regulated learning levels. Employing a quantitative approach with an experimental method, specifically the Posttest-Only Control Group Design, the research sampled VB class students as the experimental group and VC class students as the control group. Data were collected through computational thinking tests, focusing on decomposition, abstraction, algorithm design, and pattern recognition, and analyzed using a two-way ANOVA with a treatment by level 2 x 2 design. The findings reveal: (1) Computational thinking of students exposed to discovery learning differs from those taught with a scientific approach, (2) There is an interaction effect between learning models and self-regulated learning on computational thinking, (3) Students with high self-regulated learning exhibit higher computational thinking in mathematics through discovery learning compared to those taught with a scientific approach, (4) No significant difference exists in computational thinking outcomes between students with low self-regulated learning regardless of the teaching method. Consequently, discovery learning, combined with high self-regulated learning, leads to better computational thinking outcomes in mathematics.