Let the linear transformation T on the vector space $V$ over $\mathbb{Q}$ have minimal polynomial $(x^{7} - x^{3})$.
a) What is the largest invariant subspace W of V for which $T (W) = W$?
b) Find a non-constant polynomial $f(x) \in \mathbb{Q} [x] $ for which $f(T)w = w$, for all $w \in W$.
For part (a): If $W$ is any invariant subspace of T, then as an application of Division Algorithm the minimal polynomial of $T|_{W}$ divides $m_{T}$ and using this helps one to show the existence of a polynomial $p(x)$ over $\mathbb{Q}$ such that $p(x)|m_{T}(x) = (x^{7} - x^{3})$ and $W = \ker (p(T))$. Since $p(T)W = 0$, the requirement that $TW = W$ is met when $W = \ker (T - I)$. I guess what is meant by largest refers to dimension. Here, I hope I have found an invariant subspace that works, but is it the largest? I would appreciate a hint.
For part b): The polynomial $f(x) = x - 1$ satisfies the requirement.
Your question (a) is a bit strangely stated, but it actually asks for the largest invariant subspace for which its operator given by restricting $T$ to it is surjective (since $T(W)\subseteq W$ must hold by definition). Given that the minimal polynomial is $X^7-X^3=(X^4-1)X^3$ one can see that $T$ itself (acting on all of$~V$) is not surjective: the image $T^3(V)$ is contained in the kernel of $\def\I{\mathbf I}T^4-\I$, which is not the whole space (because $T^4-\I\neq0$), but if would have to be if $T$ were surjective.
By a small variation of that argument, any (invariant) subspace $W$ such that $T(W)=W$ must be contained in $\ker(T^4-\I)$, namely $\{0\}=(T^4-\I)\circ(T^3(W))=(T^4-\mathbf I)(W)$. But the subspace $W_0=\ker(T^4-\I)$ itself is $T$-stable, and $T|_{W_0}$ is invertible since its $4$-th power is the identity of $W_0$, so $W_0=\ker(T^4-\I)$ must be the answer to the first question.
The second question is quite independent. Your answer $X-1$ is wrong, since if it acted like $\I$, that is if one had $T-\I=\I$, this would mean $T=2\I$ which is incompatible with the given minimal polynomial. Of course the polynomial $1$ does act as $\I$, but a non constant polynomial is asked for. We must add to $1$ some nonzero polynomial that evaluated in $T$ does act as zero. Clearly the given minimal polynomial is such a polynomial; therefore $X^7-X^3+1$ answers the second question (or you could add any nonzero multiple of the minimal polynomial to $1$ for alternative answers).