In electrolysis, the anode is positively charged while cathode is negatively charged
So, Cu2+ moves towards the negative electrode which is cathode
while SO42- moves towards anode
Since cathode(being negatively charged) rich in electrons, Cu2+ gains 2 electrons and sticks to the electrode and becomes Cu (solid form)
While, on anode, SO42- should go to loose electrons but this doesnt happen as it requires lot of energy to do that (overvoltage)
Instead, anode (which is itself made of Cu) starts loosing electrons and starts dissolving to release Cu2+ ions (as this process will require less energy)
So, in the electrolysis of CuSo4 using Cu electrodes,
Cathode reaction: Cu2+ + 2 e ---> Cu
Anode reaction: Cu ---> Cu2+ + 2e