The fundamental group of circle is Z and the fundamental group of torus is Z×Z so that the deformation retraction is not possible.
But what is confusing to me is that I can deform retract the square I×I to I×0 which is again a circle in the quotient space. What am I doing wrong here?
A square is not a torus.
Yes, there is a certain quotient of the square which is a torus, but when you deformation retract $I \times I$ to $I \times \{0\}$ you are ignoring the quotient structure.
For starters ask yourself: those four points at the corner of the square $I \times I$ which are identified to a single point in the torus, what happens to those four points under a homotopy $$H : (I \times I) \times [0,1] \to I \times I $$ that one uses to verify that the projection map $$I \times I \to I \times \{0\} $$ is a deformation retraction?