Background. Middle school students’ math anxiety and low engagement have been major issues in math education. In order to reduce their anxiety and support their math learning, game-based learning (GBL) has been implemented. GBL research has underscored the role of social dynamics to facilitate a qualitative understanding of students’ knowledge. Whereas students’ peer interactions have been deemed a social dynamic, the relationships among peer interaction, task efficiency, and learning engagement were not well understood in previous empirical studies. Method. This mixed-method research implemented E-Rebuild, which is a 3D architecture game designed to promote students’ math problem-solving skills. We collected a total of 102 50-minutes gameplay sessions performed by 32 middle school students. Using video-captured and screen-recorded gameplaying sessions, we implemented behavior observations to measure students’ peer interaction efficiency, task efficiency, and learning engagement. We used association analyses, sequential analysis, and thematic analysis to explain how peer interaction promoted students’ task efficiency and learning engagement. Results. Students’ peer interactions were negatively related to task efficiency and learning engagement. There were also different gameplay patterns by students’ learning/task-relevant peer-interaction efficiency (PIE) level. Students in the low PIE group tended to progress through game tasks more efficiently than those in the high PIE group. The results of qualitative thematic analysis suggested that the students in the low PIE group showed more reflections on game-based mathematical problem solving, whereas those with high PIE experienced distractions during gameplay. Discussion. This study confirmed that students’ peer interactions without purposeful and knowledge-constructive collaborations led to their low task efficiency, as well as low learning engagement. The study finding shows further design implications: (1) providing in-game prompts to stimulate students’ math-related discussions and (2) developing collaboration contexts that legitimize students’ interpersonal knowledge exchanges with peers.