The expansion of gases takes place because of kinetic energy provided by heat which excites the molecules and causes them to move further apart. On cooling the atoms in a gas lose their energy and slow down coming closer together.
hope this helps lol!!!!