5. Among $2, 2^{2}, \cdots, 2^{2015}$, the numbers that have the same remainder when divided by 9 and end with the digit 2 are ( ) in number.
(A) 84
(B) 168
(C) 336
(D) 504
5. B.

From $2^{n+6}=64 \times 2^{n}=2^{n}(\bmod 9), 2^{1+4 n}$ has the same last digit as 2, we know that in $2,2^{2}, \cdots, 2^{2015}$, the numbers with the last digit 2 change in a cycle of $[6,4]=12$ numbers. Let $[x]$ denote the greatest integer not exceeding the real number $x$. Also, $2^{1}=2$ is the first number that meets the condition, and
$$
\begin{array}{l}
{\left[\frac{2015-1}{12}\right]=167,} \\
1+167 \times 12=2005<2015 \\
<2017=1+168 \times 12,
\end{array}
$$

Thus, the numbers that have the same remainder when divided by 9 and have the last digit 2 are $2^{12 \times 0+1}, 2^{12 \times 1+1}, \cdots, 2^{12 \times 167+1}$, totaling 168 numbers.