Suppose I have an $n\times n$ Hermitian matrix $H$, and a second $n\times n$ Hermitian matrix $B$ which commutes with $H$: $[H,B] = 0$. Now I project both $H$ and $B$ into a lower dimensional subspace. I have some set of vectors that form an orthonormal basis for the subspace, as the $m$ columns of a matrix $U$, with $m < n$. Projecting,
\begin{align} H_P &= U^\dagger H U\\ B_P &= U^\dagger B U \end{align}
Under what conditions will $[H_P, B_P] = 0$? Writing this out I see that, \begin{align} [H_P, B_P] &= U^\dagger H U U^\dagger B U - U^\dagger B U U^\dagger H U\\ &= U^\dagger \left( H U U^\dagger B-B U U^\dagger H\right)U \end{align}
If $UU^\dagger = I$ then the commutator vanishes. However, this question comes from some numerical work where I've seen an example for which $UU^\dagger \neq I$, but the commutator still vanishes.
You should make $U$ a square matrix by adding $n-m$ zero columns, or else it does not make sense to write $HU$, for example. It also helps to think of $U$ as a "partial isometry". It maps the span of the first $m$ standard basis vector isometrically onto the lower-dimensional subspace you are dealing with. Let $Q:=UU^\dagger$. This is orthogonal projection onto your subspace. In particular, $Q$ only depends on the subspace and not the choice of $U$. Let $H_Q:=QHQ$ and $B_Q=QHQ$. These are the compressions of $H$ and $B$ to the subspace under consideration.
If you multiply the equation $[H_P,B_P]=0$ on left by $U^\dagger$ and on the right by $U$, it becomes $[H_Q,B_Q]$. Conversely, multiplying the latter equation on the left by $U$ and on the right by $U^\dagger$ restores on the original equation.
From this we can see that a sufficient condition for the compressions to commute is that $H$ and $B$ each commute with $Q$. I guess that is the same as saying that you are compressing to a subspace which is invariant for both $H$ and $B$ (as Ben Grossmann says above).
We can also see that your claim that $UU^\dagger=I_m$ implies the compressions will commute is not correct. The span of the first $m$ basis vectors is no more special than any other $m$-dimensional subspace and, like any other subspace, compressing $H$ and $B$ to that subspace is not guaranteed to yield commuting operators.