Usually, increasing the temperature increases the solubility of solids and liquids. Increasing the temperature always decreases the solubility of gases.
When you add a solute to a solvent, the kinetic energy of the solvent molecules overcomes the attractive forces among solute particles.
The solute particles leave the surface of the solid and move into the dissolved (aqueous) phase. In the image below the mass of grey (-) balls and green (+) balls represent a salt crystal. As the salt dissolves, the positive and negative ions are pulled apart and become surrounded by water molecules.
If we heat the solvent, the average kinetic energies of its molecules increases. Hence, the solvent is able to dislodge more particles from the surface of the solute.
Thus, increasing the temperature increases the solubilities of substances. For example, sugar and salt are more soluble in water at higher temperatures.
But, as the temperature increases, the solubility of a gas in a liquid decreases. As temperature increases, the average kinetic energy of the gas molecules increases.
As a result, the gas molecules dissolved in the liquid are more likely to escape to the gas phase and not return.
Here is an experiment which demonstrates this concept.