When a compound is dissolved in another compound, there are three processes that take place. There is a breaking of bonds between the particles of the solute. This requires heat and is endothermic in nature. There is a breaking of bonds between the particles making up the solvent. This is also endothermic in nature an requires heat.
The dissolution of the solute in the solvent creates new bonds between the particles of the solute and those of the solvent. This creation of new bonds is an exothermic process that releases heat. When any substance is dissolved in another, the dissolution could be endothermic or exothermic based on whether the heat released in the final stage is less than the sum of the heat absorbed in the initial stages or not.
Dissolving acids in water usually generates a lot more heat due to the formation of new bonds between the particles that make up the acid and the water molecules than the total heat absorbed in the breaking of bonds between the water particles and the breaking of bonds between the particles of the acid. This results in a generation of heat when an acid is dissolved in water.