Iron nails lose their shiny appearance because an insoluble layer of copper is formed on the nails, Meanwhile, the solution,CuSO4 loses its blue color because of the formation of FeSO4. This reaction is called displacement reaction in which the reactive element Iron, Fe has displaced less reactive Copper from its solution, The chemical equation can be written as:
Fe+CuSO4→Cu+FeSO4