Expanding on the last point by @KevinZhou, temperature is most properly thought of as the "willingness" of the system to transfer heat. It is, in fact defined as
$\frac{1}{T} = \frac{\partial S}{\partial E}$
where $S$ is entropy and $E$ is internal energy. For a system consisting of two objects in thermal contact they will exchange energy such that they maximize the entropy of the system is maximized. So, if one can lose a little bit of entropy by giving up some energy and the other will increase its entropy by a large amount by taking in that energy then the energy will "flow" so that this happens. In other words, the system with a large $\partial S/\partial E$ "grabs" the energy from the one with small $\partial S/\partial E$. That is, energy flows from the one with high $T$ to the one with low $T$. The great thermal physics textbook by Schroeder makes the analogy that $E$ is "money", $S$ is "happiness" and $T$ is "generosity". The more generous system gives money to the less generous one to increase the overall happiness.
@KevinZhou says that temperature can be thought of as a measure of the amount of thermal energy. Most of the time you can get away with this but it isn't technically correct. We can form a relation between temperature and thermal energy for any system, but this isn't what temperature "is" (similarly $\sum F = ma$ means the sum of forces is equal to $ma$ not that the sum of forces "is" $ma$. Fundamentally the temperature is a measure of the system's willingness to transfer heat to other systems.