A discontinuous function, such as one that fails to equal $0$ at only finitely many points in $[0,1]$ could have a square integral of $0$ without being the zero function. However, if a function is continuous, so its square is also continuous, then having a non-zero value at some point would cause the square function to have its value strictly positive at that point, and by continuity, on some neighborhood of that point. That would result in an integral greater than $0$.
More formally, suppose $f(x_0)\ne 0$, then $f^2(x_0)=a>0$. By continuity, there is some $\delta$ such that $|x-x_0|<\delta\implies f^2(x)>\frac{a}{2}$, so $\int_0^1 f^2(x)\,dx\ge a\delta>0$.