Cobalt has electronic configuration-[Ar]3d7.
It is a d-block element.
While, you must know that Na is a s block element.
As, we already know, s block elements are highly electropositive. So, they easily lose electrons, and form ions.
So, Na forms Na+ easily. Chlorine is a highly electronegative element, so it forms Cl-and easily.
We know, the compound from highly Electronegative and Electropositive elements has an easily ionisable bond. This is because Na+ has complete octet and is stable, so is, Cl- .
So, NaCl, in presence of polar solvent like water, ionises easily to form Na+ and Cl- ions, and hence, easily dissolves in water.
But cobalt is a d block element. So, it is not highly electropositive. Also, in cobalt chloride, Cobalt exist as Co2+ . This is not as stable as Na+, as octet is not complete . So, CoCl2 will not easily ionise into Co2+ and Cl - . So, as ions are not easily formed, CoCl2 is less soluble.