In QM, does an algebra containing the Hamiltonian always evolve into itself? Let $\mathcal{A}$ be an algebra of operators on a Hilbert space $\mathcal{H}$, and suppose it contains the Hamiltonian: $H\in\mathcal{H}$. The Heisenberg evolution for any $\hat{O}\in\mathcal{A}$ is
$$\tag{1} \hat{O}(t)=e^{itH/\hbar}\hat{O}(0)e^{-itH/\hbar}.$$
All three terms on the RHS are in $\mathcal{A}$, and so $\hat{O}(t)\in\mathcal{A}$ for all $t$. That is, time evolution maps $\mathcal{A}$ into itself.

The above seems correct, but a particle moving on a line seems to provide a counterexample. Let $\mathcal{H}=L^2(\mathbb{R})$, with position and momentum operators $\hat{x},\hat{p}$. Take the Hamiltonian $H=\hat{p}$. Finally, let $$\tag{2}\mathcal{A}=\{f(\hat{x}):f\text{ is smooth },supp(f)\subseteq (0,1)\} \oplus span(\hat{p}).$$
To see that (2) is closed under the bracket, use
$$\tag{3}[f(\hat{x}),\hat{p}]=i\hbar f'(\hat{x})$$
and note that if $supp(f)\subseteq (0,1)$ then  $supp(f')\subseteq (0,1)$.
Now, since $\hat{p}\in\mathcal{A}$, we expect $\mathcal{A}$ to evolve into itself. But this is not true. We have
\begin{align}
   \tag{4}f(\hat{x})(t) &= f(\hat{x}(t)) \\
   \tag{5} &= f(e^{it\hat{p}/\hbar} \hat{x}(0) e^{-it\hat{p}/\hbar}) \\
   \tag{6}&= f(\hat{x}(0)+tI )
\end{align}
where $I$ in the last line is the identity operator.
After unit time, any $f$ initially with support in $(0,1)$ evolves to have support outside $(0,1)$. Hence $\mathcal{A}$ doesn't evolve into itself.
Where was my mistake? Is there an issue with operators being unbounded? Note that in order to vanish outside $(0,1)$ but be nonzero inside, $f$ must be non-analytic -- maybe this is somehow important?
 A: If $\mathcal{A}\subset \mathfrak{B}(\mathcal{H})$ is an algebra of bounded operators on a Hilbert space $\mathcal{H}$ (it is better to restrict to bounded operators because unbounded operators can usually not be multiplied with each other), and a (possibly unbounded operator) $H$ is affiliated with $\mathcal{A}$ (i.e. bounded functions of $H$ are elements of $\mathcal{A}$), then $A\in\mathcal{A}$ implies that, for every $t\in\mathbb{R}$, $\mathrm{e}^{\mathrm{i}tH}A\mathrm{e}^{-\mathrm{i}tH} \in \mathcal{A}$. This is clear because, by assumption, $\mathrm{e}^{\mathrm{i}tH}\in \mathcal{A}$, and products of elements of $\mathcal{A}$ is an element of $\mathcal{A}$.
Actually, the more interesting question is whether the invariance of $\mathcal{A}$ under the adjoint action of $\mathrm{e}^{\mathrm{i} t H}$ implies that $H$ is affiliated with $\mathcal{A}$. This question can be answered for von Neumann algebras by the Borchers--Arveson theorem.
I think the problem with your example is that $\mathcal{A}$ is not an operator algebra (even if we ignore problems related to unbounded operators). Moreover, you defined $\mathcal{A}$ as a direct sum but you act with operators from the second summand on the first summand.
