5. For any integer $n$, the remainder when the algebraic expression $n^{2}-n+4$ is divided by 9 will not be ( ).
(A) 0
(B) 1
(C) 6
(D) 7
5.A.

When $n=3$, the remainder can be 1;
When $n=4$, the remainder can be 7;
When $n=5$, the remainder can be 6.
The following proves that $n^{2}-n+4$ cannot be divisible by 9.
If not, then
$9 \mid\left[(n-2)^{2}+3 n\right]$.
Since $3 \mid 3 n$, it follows that $3 \mid(n-2)^{2}$.
But 3 is a prime number, so
$3 \mid (n-2)$.
Thus, $9 \mid(n-2)^{2}$.
From (1) and (3),
$9 \mid 3 n \Rightarrow 3 \mid n$.
The contradiction from (2) and (4) shows that $n^{2}-n+4$ cannot be divisible by 9.