The short answer is that you can rewrite as a sum of squares of normal random variables and that, under the null hypothesis, each of the terms is and hence you get the chi-square distribution you asked for. The crucial role the null hypothesis plays is that, if the null hypothesis is false, then the terms you are summing up will not have mean 0 and so you don't get a chi-square when you add them up (you get a noncentral chi-square instead).

The long answer is very long unless you know a good bit of matrix algebra.