This has to do with kinetic energy. When molecules of a substance bump into one another (when matter is heated), molecules accelerate, move more often at random within a given space, then spread farther apart.
Corresponding to increasing kinetic energy, the three states of matter are solid, liquid and gas (from less to greater). H20 is an example; the three states are ice, water, and steam.
Robert Fulton's invention of the steam engine functions by the principle of expansion of matter with heat, when molecules of water escape the liquid state to become become gas (at the boiling point).
This is caused by the kinetic energy of the particles. As it changes state, it start to increase in energy and start to move faster. It begins to be bombarded by other neighboring particles surrounding it, and start to increase in speed, moving randomly in all direction and spread father apart, the distance between the particles increasing. The kinetic energy increases, from solid, liquid and later to gas respectively.