During dissolution of ionic compounds, the thermal outcome is given by balancing of the energy needed to break the ionic lattice and the energy released by the ion hydration, wrapping them by water molecule dipoles.
Nice example of this is exothermic (heat releaseing) dissolution of CaCl2 (where significant energy is released by $\ce{Ca^2+}$ hydration) versus endothermic (heat absorbing) dissolution of $\ce{CaCl2 . 6 H2O}$ where $\ce{Ca^2+}$ is "pre-hydrated". This energy balance is about neutral for $\ce{NaCl}$.
See also Wikipedia: Gibbs free energy as thermodynamic parameter for evaluation of spontaneity of processes, involving both energy outcome and entropy change (in layman terms the level of disorder). Even energy consuming dissolution may happen, if the total entropy (disorder) change of the universe increases by that.
Note that thermodynamics ( energy and entropy changes ) and kinetics (rates of changes) are in large extent independent. Like 2 paths across mountains, one with bigger altitude change but through a lower pass and the other with smaller altitude change, but via a higher pass.