The fundamental rule of solubility is that "like solutes would dissolve in like solvents". Both NaCl and water are polar compounds.
NaCl is an ionic compound which forms from transfer of an electron from the Cl atom and a loss of electron from Na. This leaves a separation of charge on both atoms with Na being positively charged and Cl being negatively charged. This charge separation makes NaCl a polar compound.
Water on the other hand is a polar covalent solvent. The covalent bond results from the sharing of electrons between oxygen and hydrogen atoms. Due to the more electronegative nature of Oxygen, it pulls the shared electron more closely to itself than the Hydrogen atom. This unequal sharing of the electron leaves a net positive charge on Hydrogen and a negative charge on Oxygen.