Why does the way we write the matrix for a linear transformation differ here?

In the first example the first component is just a number. It is determined from the coefficients, which aren't given yet. But if you specify some coefficients then it collapses to just a number, for example $T(1,2,3)$ will have first component $-1+2-3=-2$.

In your second example you are already plugging in coefficients, specifically $(1,0,0,0)^T$ in the monomial basis, so you get back a single polynomial (namely the polynomial $x \mapsto 1$).

That said, in general the columns of a matrix representation of a linear transformation are the values given by plugging in the basis elements, in other words the $k$th column of the matrix representation of $T$ will correspond to $T(e_k)$ where $e_k$ is the $k$th element of the basis for the domain. So in the second example, the fact that $T(1)=1 + 0x + 0x^2 + 0x^3$ will appear in the first column of the matrix representation. You should try to understand why that has to be; IMO you won't really understand matrix representations of linear transformations without both understanding this fact and how it comes about from the definitions.