Whenever copper sulfate or CuSO4 is added to water, it gets dissolved in the water. As the CuSO4 is an electrolyte, it splits into Cu++ (cation) and SO4−− (anion) ions and move freely in the solution. Now if two copper electrodes are immersed in that solution, the Cu++ ions (cation) will be attracted towards cathode i.e. the electrode connected to the negative terminal of the battery . On reaching on the cathode, each Cu++ ion will take electrons from it and becomes neutral copper atoms. Similarly the SO4−− (anion) ions will be attracted by anode i.e. the electrode connected to the positive terminal of the battery . So SO4−− ions will move towards anode where they give up two electrons and become SO4 radical but since SO4 radical can not exist in the electrical neutral state, it will attack copper anode and will form copper sulfate.
Hence, When electric current is passed through the copper sulfate solution, free copper ions gets drawn to the electrode connected to the negative terminal of the battery and gets deposited on it.