Within the context of scalar-tensor gravity, we explore the generalized second law (GSL) of gravitational thermodynamics.We extend the action of ordinary scalar-tensor gravity theory to the case in which there is a nonminimal coupling between the scalar field and the matter field (as a chameleon field). Then we derive the field equations governing the gravity and the scalar field. For a Friedmann-Robertson-Walker universe filled only with ordinary matter, we obtain the modified Friedmann equations as well as the evolution equation of the scalar field. Furthermore, we assume the boundary of the Universe to be enclosed by the dynamical apparent horizon that is in thermal equilibrium with the Hawking temperature. We obtain a general expression for the GSL of thermodynamics in the scalar-tensor gravity model. For some viable scalar-tensor models, we first obtain the evolutionary behaviors of the matter density, the scale factor, the Hubble parameter, the scalar field, and the deceleration parameter, as well as the effective equation of state (EoS) parameter.We conclude that in most of the models, the deceleration parameter approaches a de Sitter regime at late times, as expected. Also, the effective EoS parameter acts like the ΛCDM model at late times. Finally, we examine the validity of the GSL for the selected models.