Background: The increasing prevalence of diabetes mellitus has become a global public health challenge in recent decades. However, disease-related complications can be minimized through innovative educational programs. Objectives: This study aimed to compare the effects of healthy lifestyle education delivered via peer group and the mHealth app on self-esteem in patients with type 2 diabetes mellitus (T2DM). Methods: This three-group randomized controlled trial was conducted in 2022. A total of 135 patients living with T2DM were recruited using purposive sampling from two hospitals in Kermanshah Province, Iran, and then divided into three groups: Peer education, virtual education, and control groups, via replacement randomization. Peer patients with T2DM, previously trained by the researchers, provided education to those in the peer education group in four 35-minute sessions over two days. Simultaneously, patients in the virtual education group were trained by the researchers using the mHealth app, specifically designed for this purpose, in three 1-hour sessions over three days. Data were collected using the Patient Profile Form and the self-reported Rosenberg’s Self-Esteem Scale. The data were analyzed using IBM SPSS Statistics software, employing paired-sample t-tests, chi-square tests, Fisher’s exact tests, and one-way analysis of variance (ANOVA) for comparisons. Results: Before the intervention, there were no significant differences in the self-esteem mean scores between the study groups (P = 0.665). However, post-intervention, the self-esteem scores differed significantly between all groups (P = 0.002). The self-esteem mean scores of patients in the peer education group (100.36 ± 15.9 vs. 106.87 ± 9.08, P = 0.011) and the virtual education group (100.80 ± 24.72 vs. 116.91 ± 10.67, P = 0.018) significantly increased after the intervention, while no significant difference was observed in the control group (106.87 ± 9.08 vs. 105.60 ± 10.84, P = 0.134). Virtual education via the mHealth app was more effective than peer education in improving self-esteem in patients with T2DM. Conclusions: The healthy lifestyle education program delivered through virtual education via the mHealth mobile app led to higher self-esteem among patients with T2DM compared to peer education. It is suggested that future studies investigate the impact of virtual education using mobile-based apps and artificial intelligence capabilities on self-esteem in other patient populations. These results can serve as guidelines for the optimal use of distance education and educational apps for patients with chronic diseases.