I read in a textbook the proof for $p \rightarrow (q \rightarrow r) \vdash (p \wedge q) \rightarrow r$ is like this:
$1.\hspace{10mm} p \rightarrow (q \rightarrow r) \hspace{10mm}\text{premise}$
$2.\hspace{20mm} p \wedge q \hspace{13mm}\text{assumption}$
$3.\hspace{20mm} p \hspace{20mm}\text{∧-elim}_{1}\text{ 2}$
$4.\hspace{20mm} q \hspace{20mm}\text{∧-elim}_{2}\text{ 2}$
$5.\hspace{20mm} q \rightarrow r \hspace{11.5mm}\text{→-elim}\text{ 1, 3}$
$6.\hspace{20mm} r \hspace{20.5mm}\text{→-elim}\text{ 5, 4}$
$7.\hspace{10mm} (p \wedge q) \rightarrow r \hspace{12mm}\text{→-intro}\text{ 2-6}$
My question is why was the assumption $p \wedge q$ made? Rather if I assumed $p$ and $q$, then couldn't I do a conjunction introduction in next line?
$p \hspace{10mm}\text{assumption}$
$q \hspace{10mm}\text{assumption}$
$p \wedge q \hspace{10mm}\text{∧-intro}$
The rule of conditional introduction ($\to\!\mathsf i$) discharges the assumption and makes it the antecedent for the conditional statement. Meanwhile the conclusion derived within the context of that assumption becomes the consequent of the conditional statement.
So if you want to deduce $(p\land q)\to r$ using this rule, you are required to assume the antecedent ($p\land q$) aiming to derive the consequent ($r$).
Deriving $p\land q$ along the way from some other assumptions will not set things up for you to apply the rule and deduce the desired conditional. Deriving $r$ under assumptions of $p$ and then $q$ will only allow you to deduce $p\to (q\to r)$ which, being the premise itself, is unremarkable.
$$\def\fitch#1#2{\quad\begin{array}{|l} #1\\\hline #2\end{array}}\fitch{p\to(q\to r)}{\fitch{\color{blue}{p\land q}}{q\\p\\q\to r\\\color{red}r}\\\color{blue}{(p\land q)}\to\color{red} r}\qquad\fitch{p\to(q\to r)}{\fitch{p}{\fitch q{p\land q\\p\\q\to r\\r}\\q\to r}\\p\to(q\to r)}$$