Observe that if $\{x_1,...,x_n\}$ is a subset of $[0,1]$ with $n$ members, and $\{y_1,...,y_n\}\subset [0,1],$ there exists a continuous $f:[0,1]\to [0,1]$ such that $f(x_i)=y_i$ for $i\in \{1,...,n\}.$
Since $g$ is not constant, take $a,b$ with $0\leq a<b\leq 1$ and $g(a)\ne g(b).$ Take a strictly increasing or strictly decreasing sequence $(y_n)_{n\in N}$ with $y_1=g(a)$ and $\lim_{n\to \infty}y_n=g(b).$
Since $g$ is continuous,by the IVT we may, for each $n\in N$, choose $x_n\in [a,b]$ with $g(x_n)=y_n.$
For each $n\in N$ take a continuous $f_n:[0,1]\to [0,1]$ such that $f_n(y_j)=0$ if $j<n,$ and $f_n(y_n)=1.$ Therefore, for $m<n$ we have: $$(T f_m)(x_m)=f_m(g(x_m))=f_m(y_m)=1.$$ $$ (T f_n)(x_m)=f_n(g(x_m))=f_n(y_m)=0.$$ $$\text {So }\quad m\ne n\implies \|(T f_m)-(T f_n)\|=1.$$ Hence the sequence $(T f_n)_{n\in N}$ has no convergent subsequences,so the image under $T$ of the closed unit ball is not compact