When an iron nail dipped in the copper sulphate solution than iron displaces copper from the copper sulphate because iron is more reactive than copper. Therefore the colour of the copper sulphate solution changes.
The reaction involved here is:
Fe (s) + CuSO4 (aq) → FeSO4 (aq) + Cu (s)