Is kinetic energy in infinite square well conserved? First we know that $\langle\hat{p}\rangle$ is not conserved, since the potential $V(x)$ is not invariant under translations therefore $\hat{p}$ does not commute with $\hat{H}$. Thus $T=\frac{\hat{p}^2}{2m}$ does not commute with $\hat{H}$ either, since the former share the same set of eigenfunctions with $\hat{p}$. So according to Heisenberg Equation, kinetic energy is not conserved.
However, $\langle T\rangle=\langle H\rangle$ by virtue of infinite square well, so it seems that $\frac{\mathrm{d}\langle T\rangle}{\mathrm{d}t}=\frac{\mathrm{d}\langle H\rangle}{\mathrm{d}t}=0$ ? Where am I wrong?
Furthermore, I would like to ask why it requires $[\hat{H},\hat{Q}]=0$ to say that $Q$ is conserved? As far as I see, as long as $[\hat{H},\hat{Q}]f=0$ for any $f$ that satisfies Schrödinger Equation instead of any $f$ in Hilbert Space, we can derive $\frac{\mathrm{d}\langle Q\rangle}{\mathrm{d}t}=0$. (Assume $\hat{Q}$ does not depend explicitly on $t$.)
 A: Obviously the energy is conserved: $$H(t)= e^{itH/\hbar}He^{-itH/\hbar}=H\:,$$
since functions of a given selfadjoint operator (here the Hamiltonian $H=T$) always commute. There is no potential energy here. Physically speaking, the presence of an infinite well is embodied in the boundary conditions which make $H$ (essentially) selfadjoint: the admitted functions in the domain of $H$ vanish at the boundary.
Regarding the momentum operator, it simply does not exist as a selfadjoint operator in the infinite well (imposing vanishing boundary conditions we do not have a selfadjoint operator contrarily to $H$).
Finally, the requirement $[Q,H]=0$, with some technical  mathematical  hypotheses implies that $Q$ is conserved $$Q(t)= e^{itH/\hbar}Qe^{-itH/\hbar}=Q\:.$$ Also the converse inplication is true, so that, under suitable hypotheses, $[Q,H]=0$ is equivalent to the conservation of $Q$ along the dynamics generated by $H$.
A: The momentum opertor $\hat p$ does not have any eigenfunctions in an infinite square well because $\hat p\psi=k\psi$ would require $\psi= e^{ikx}$, and there is no value of $k$ susch that $\psi(0)=\psi(L)=0$.
A: 
since the former share the same set of eigenfunctions with $\hat{p}$. So according to Heisenberg Equation, kinetic energy is not conserved.

For the "particle-in-a-box," eigenfunctions of the Hamiltonian are eigenfunctions of the kinetic energy, but are not eigenfunctions of the momentum.
We know that the eigenfunctions of the Hamiltonian are:
$$
\phi_n(x) = \sqrt{\frac{2}{L}}\sin(\frac{n\pi x}{L})\;,
$$
inside the box, and $\phi_n=0$ outside the box.
Acting $\hat p$ on $\phi_n$ gives:
$$
\hat p \phi_n(x) = -i\hbar\frac{\pi n}{L}\sqrt{\frac{2}{L}}\cos(\frac{n\pi x}{L})\;,
$$
the RHS of which has a $\cos$ not a $\sin$, so $\phi_n$ is not an eigenfunction of $\hat p$.
Acting $\hat p^2$ on $\phi_n$ gives:
$$
\hat p \hat p \phi_n(x) = -(-i\hbar)^2(\frac{\pi n}{L})^2\sqrt{\frac{2}{L}}\sin(\frac{n\pi x}{L}) = \frac{\hbar^2 \pi^2 n^2}{L^2}\phi_n\;.
$$
So, we see that $\phi_n$ is an eigenfunction of $\hat p^2$ and therefore $\phi_n$ is an eigenfunction of $\hat T$. This should also be clear from the fact that $H=T$ everywhere that $\phi_n$ is not zero.

However, $\langle T\rangle=\langle H\rangle$ by virtue of infinite square well, so it seems that $\frac{\mathrm{d}\langle T\rangle}{\mathrm{d}t}=\frac{\mathrm{d}\langle H\rangle}{\mathrm{d}t}=0$ ? Where am I wrong?

You are not wrong.

Update:
Because of the toy nature of the particle-in-a-box model, kinetic energy is conserved. Momentum is not generally conserved.
Kinetic energy is conserved because the Hamiltonian is effectively equal to the kinetic energy (the potential effectively just enforces the toy model boundary condition).
Below, I consider momentum.
For any eigenfunction of the Hamiltonian $\phi_n$:
$$
p_{nn} = \langle \phi_n|\hat p|\phi_n\rangle = 0\;.
$$
We also have:
$$
p_{nm} = - p_{mn}=p_{mn}^*\;.
$$
More explicitly:
$$
p_{r+q,r} = \langle \phi_{r+q}|\hat p|\phi_r\rangle = \frac{4\hbar r(r+q)}{iq(2r+q)}\;,
$$
when $q$ is odd, and zero otherwise.
The most general solution to the Schrodinger equation that we can write down for this toy model is:
$$
\Psi(x,t) = \sum_n a_n e^{-i\epsilon_n t/\hbar} \phi_n(x)\;,
$$
where $\epsilon_n=\frac{\hbar^2n^2\pi^2}{2mL^2}$ and $a_n$ is $\int dx \phi_n\Psi(x,0)$.
For this most general state, we have:
$$
p(t) = \langle \Psi|\hat p|\Psi\rangle
=\sum_{n,r}a_n^*a_r p_{nr}e^{it(\epsilon_n-\epsilon_r)/\hbar}
$$
$$
=\sum_{r=1}^\infty\sum_{q=-r + 1; {odd}}^{\infty} a_{r+q}^* a_r \frac{4\hbar r(r+q)}{iq(2r+q)} e^{it\pi^2\hbar q(2r+q)/2mL^2}
$$
For example, suppose I have a state $\Psi(x, 0)$ at $t=0$ with
$$
a_1 = i/\sqrt{2}
$$
and
$$
a_2 = 1/\sqrt{2}\;.
$$
Then, the time dependence of the momentum would look like:
$$
p(t) = \frac{i}{2}p_{12}(2\cos(\Delta t)/\hbar) = -\frac{i}{2}p_{1+1,1}(2\cos(t\Delta))
=-\frac{8\hbar}{3}\cos(\Delta t/\hbar)\;,
$$
where $\Delta = \epsilon_2 - \epsilon_1$.
A: Your argument that if $A$ doesnt commute with $H$ so this also applies to $A^2$ is wrong. For example, in a 2 dimentions, suppose A is $\begin{pmatrix} 1\ 0\\ 0\ -1\end{pmatrix}$ then $A^2$ commutes with everything (the identity matrix)
