2. The function $f(x)$ defined on the set of positive integers satisfies
$$
f(x)=\left\{\begin{array}{ll}
f(f(x-7)), & x>1005 ; \\
x+3, & x \leqslant 1005 .
\end{array}\right.
$$

Then the value of $f(2006)$ is ( ).
(A) 1005
(B) 1006
(C) 1007
(D) 1008
2.A.

Since $2006=1005+143 \times 7$, we have
$$
f(2006)=f_{2}(1999)=\cdots=f_{144}(1005) \text {. }
$$

Also, $f(1005)=1008$,
$$
\begin{array}{l}
f(1008)=f_{2}(1001)=f(1004)=1007, \\
f(1007)=f_{2}(1000)=f(1003)=1006, \\
f(1006)=f_{2}(999)=f(1002)=1005,
\end{array}
$$

Therefore, $f_{m}(1005)$ has a period of 4.
Since $144 \div 4=36$, with a remainder of zero, hence
$$
f(2006)=f_{144}(1005)=1005
$$