Intuition Behind Commitment-Challenge-Response a.k.a. Sigma Protocols
As a concert example lets consider the protocol for knowledge of discrete-logarithm.
The aim of the protocol: P wants to prove that it knows $x$ for $pk=g^x$.

commitment: P chooses a random $r$ and commit to it by sending $R=g^r$ to the verifier.

challenge: the verifier chooses a random value $c$ and sends it to P.

P sends $z=r+cx$ to the verifer.

verification: the verifier checks if $g^z=R.pk^c$ if yes it accepts it.


Now what will happen if the prover does not commit to $R$ before sending $z$ ?
After receiving $c$ from the verifier, P chooses a random $z$ and finds $R'$ from the equation $g^z=R'pk^c$, i.e., it sets $R'=g^zpk ^{-c}$.  Then it sends $R',z$ to the verifier.
By this $R'$ it can pass the verification check, and the point is that it even does not use $x$ in $z$. This means a malicious prover who does not have $x$ can prove the knowledge of $x$!
Putting together, commitment is necessary to protect the proof system against prover such that just the honest provers can convince the verifier.