This study aims to understand the mediating effect of self-esteem in the effects of aging anxiety on depression in the middle-aged and elderly generations living in local communities. To achieve this purpose, a survey was conducted in December 2019 among 200 middle-aged people and 300 elderly residing in Seoul, Gyeonggi, and Seosan, Chungnam with the cooperation of the institutions such as the local lifelong learning centers, general social welfare centers, and volunteer centers, and the help of people in charge. In the case of the middle-aged, 200 copies were finally collected and used for analysis. In the case of the elderly, additional help was received from the elderly welfare centers. In general, 286 copies were used for analysis, excluding 14 copies of the questionnaire with no response. For the analysis, IBM SPSS 21.0 and SPSS PROCESS macro model No. 4 were used. The main research results are summarized as follows. First, it was found that aging anxiety and depression were higher in the elderly, and self-esteem was higher in the middle-aged. Second, as a result of verifying the mediating effect of self-esteem in the relationship between aging anxiety and depression, the higher the aging anxiety in both the middle-aged and elderly generations, the higher the feeling of depression, but the effect of aging anxiety on depression decreased when self-esteem was added. In other words, the mediating effect of self-esteem was verified in the relationship between aging anxiety and depression. These results are meaningful in that it revealed that the aging anxiety of the middle-aged and elderly generations causes depression, but if self-esteem is high, this influence could be weakened. Therefore, it is suggested a self-esteem improvement program for the middle-aged and elderly generations.