You can prove this by induction. Start with this lemma. For $a, b, c \geq 0$ we have:
$$a^2 + (a + b + c)^2 \geq (a + b)^2 + (a + c)^2$$
The proof just involves expanding out all terms and noticing that there is an extra $bc$ term on the LHS.
Let $m = \frac{k}{n}$. Let $S = \sum_{i = 1}^n x_i^2$. Let $M = nm^2$. We want to show that $S \geq M$.
Then we can proceed by induction on the number of terms $x_i$ which are not equal to $m$. In the base case, all terms are equal to $m$, and so $S = M$, and we're done.
In the inductive case, then WLOG assume that the terms $x_i$ are ordered in increasing order. And so $x_n > m$ and therefore $x_1 < m$. Let $a = x_n - m$ and let $b = m - x_1$. Then:
$$x_n = x_1 + a + b$$
Now let $x_1' = x_1 + a$ and let $x_n' = x_1 + b = m$. Then by our lemma, $x_1^2 + x_n^2 \geq x_1'^2 + x_n'^2$. So letting $S' = x_1'^2 + \sum_{i = 2}^{n - 1} x_i^2 + x_n'^2$ we have that $S \geq S'$. Also, clearly replacing $x_1$ and $x_n$ with $x_1'$ and $x_n'$ respectively preserves the total sum $k$. And since $x_n' = m$, then the number of terms that are not equal to $m$ has decreased after we make the replacement. So we can apply the inductive hypothesis yielding $S' \geq M$. Putting it all together:
$$S \geq S' \geq M$$
And that completes the proof.