In this paper, a generalized Gronwall inequality is demonstrated, playing an important role in the study of fractional differential equations. In addition, with the fixed-point theorem and the properties of Mittag–Leffler functions, some results of the existence as well as asymptotic stability of square-mean S-asymptotically periodic solutions to a fractional stochastic diffusion equation with fractional Brownian motion are obtained. In the end, an example of numerical simulation is given to illustrate the effectiveness of our theory results.