Hint: assume $U\ne\{0\}$ and $U\ne V$; then if $\{u_1,\dots,u_k\}$ is a basis for $U$, you can extend it to a basis $\{u_1,\dots,u_k,u_{k+1},\dots,u_n\}$ of $V$. You can define a linear map $V\to V$ by telling the action on a basis. Can you make $f$ that shows $U$ is not $f$-invariant?
Note: you don't need finite dimensionality, but of course the proof in the non finite dimensional case requires the axiom of choice.
Details (added after accept)
We know that $0<\dim U=k<\dim V=n$, so in the argument we do have $u_1$ and $u_{k+1}$. Thus the linear map $f\colon V\to V$ defined by
$$
f(u_i)=\begin{cases}
u_{k+1} & \text{if $i=1$}\\
0 & \text{if $1<i<n$}
\end{cases}
$$
shows $U$ is not $f$-invariant.
The same idea can be used in the general case: take a non-zero vector $u\in U$ and extend it to a basis $B$ of $U$; now take $v\notin U$ and extend $B\cup\{v\}$ to a basis $C$ of $V$ (this is possible using Zorn's lemma). Then define the linear map $f\colon V\to V$ by $f(u)=v$ and $f(w)=0$ for $w\in C$, $w\ne u$.
Another possibility is to define $f(u_i)=u_{i+1}$ for $1\le i<n$ and $f(u_n)=u_1$. Since $f(u_k)=u_{k+1}\notin U$, $U$ is not $f$-invariant.
Yes, $\text{range}(T-\lambda I)$ is invariant under $T$. Here's a quick proof, assuming we're in a finite-dimensional vector space $V$ and $T:V\to V$ is a linear map.
Suppose $v\in \text{range}(T-\lambda I)$. Then, $v = (T-\lambda I) w$ for some $w\in V$. What is $Tv$?
$$Tv = T(T-\lambda I)w = T^2w - \lambda Tw = (T-\lambda I)(Tw) = (T-\lambda I)w'$$
where $w' = Tw$. Clearly, $(T-\lambda I)w' \in \text{range}(T-\lambda I)$. So, $Tv \in \text{range}(T-\lambda I)$. This works for arbitrary $v\in \text{range}(T-\lambda I)$, so $\text{range}(T-\lambda I)$ is invariant under $T$.
In other words, we have shown that
$$T (\text{range}(T-\lambda I)) \subseteq \text{range}(T-\lambda I)$$
which is exactly how one should proceed to prove $T$-invariance of a subspace.
Some words about your particular counterexample: You've correctly identified $\lambda = 1$. Let's find $\text{range}(T-\lambda I)$ for you. Consider some $(x,y)\in\Bbb R^2$.
$$(T-\lambda I)(x,y) = T(x,y) - (x,y) = (x,0) - (x,y) = (0,-y)$$ i.e. the range consists of vectors on the $Y$ axis .
You also want to find $\ker(T-\lambda I)$, so let's see how that works. If $(x,y) \in \ker(T-\lambda I)$, then $$(T-\lambda I)(x,y) = (0,0) \implies (x,0) - (x,y) = (0,0) \implies y = 0$$
i.e. precisely those vectors which are on the $X$-axis.
I leave it to you to find $\text{range}\ T$ and $\ker T$.
Best Answer
Take $T$ to be the identity. Then every subspace is $T$-invariant. But in general, $IU=UI$ and not every subspace is $U$-invariant.