By expanding out the square, you can easily show that $$\sum_{i=1}^n(X_i-\bar X)^2=\sum_{i=1}^nX_i^2-n\bar X^2,$$ using the fact that $\sum_{i=1}^n(X_i)=n\bar X.$
So we need to calculate $$\mathop{\mathbb{E}}\left[\sum_{i=1}^nX_i^2\right]+\mathop{\mathbb{E}}\left[n\bar X^2\right].$$
The first term, by the iid condition, is equal to $n\mathop{\mathbb{E}}\left[X_i^2\right].$ Now note that $\mathop{\text{Var}}(X_i)=\mathop{\mathbb{E}}\left[X_i^2\right]-\mu^2,$ so $\mathop{\mathbb{E}}\left[X_i^2\right]=\sigma^2+\mu^2.$
Now let $Y=\bar X.$
Then
$$
\begin{align*}
\mathop{\mathbb{E}}\left[Y^2\right]
&=\mathop{\text{Var}}(Y)+(\mathop{\mathbb{E}}\left[Y\right])^2\\
&=\mathop{\text{Var}}\left(\frac{1}{n}\sum_{i=1}^{n}X_i\right)+\mu^2\\
&=\frac{1}{n^2}\mathop{\text{Var}}\left(\sum X_i\right)+\mu^2\\
&=\frac{1}{n^2}n\sigma^2+\mu^2\\
&=\frac{\sigma^2}{n}+\mu^2.
\end{align*}
$$
So the whole expectation becomes $n(\sigma^2+\mu^2)-n(\sigma^2/n+\mu^2)=n\sigma^2-\sigma^2$ as required.