When does thermal equilibrium occur?
Thermal equilibrium, between two or more bodies, takes place when there is no heat transfer between them and all of the participating bodies are at the same temperature. If we keep two bodies in contact with each other, in an isolated system (that is they are not in contact with any other body to which heat can be lost or gained from) and one of them has a higher temperature than the other, we will observe the transfer of heat from the hotter body to the colder body. The rate of heat transfer will be a function of thermal or temperature gradient between the two; higher the gradient, faster is the heat transfer. Over time, the hotter body will cool down, while the temperature of the colder body will increase. This will continue till both the bodies are at the same temperature, i.e. achieve thermal equilibrium with each other.
Hope this helps.