Na and Cl have difference in electronegativity. Na is electropositive whereas Cl is electronegative. Thus, Na and Cl forms oppositively charged ions. Now, NaCl may look neutral as a whole but Na-Cl bond is polar. It can be given as,
Naᵃ⁺----- ᵃ⁻Cl. Due to this polar bond, NaCl has the tendency to attract H₂O molecules towards itself. O atom interacts with Na whereas H atoms interact with Cl atoms. Why? Because attractions happens between unlike charges. This process is called solvation