**EDIT:** Bill Johnson has pointed out a gap in my initial answer. It seems that bridging this gap is just as difficult as proving that $tr(AB)=tr(BA)$. Below I give two other proofs of this equality. The flawed proof is also reproduced at the end.

**Proof 1** (alluded to by Bill in his comment to Gjergji's answer): It's well-known that $AB$ and $BA$ have the same nonzero eigenvalues (with the same multiplicities). Lidskii's trace formula then implies that $tr(AB)=tr(BA)$. QED.

**Proof 2**: This proof doesn't use Lidskii's formula. It's taken from

Laurie, Nordgren, Radjavi, Rosenthal, *On triangularization of algebras of operators.* Reine Angew. Math. **327** (1981), 143–155.

We'll need to rely on the fact that $tr(ST)=tr(TS)$ if one of $S$ and $T$ is trace class.

Let $A=UP$ be the polar decomposition of $A$. Then $PB=U^\ast AB$ is trace class. But then one knows that $tr(UPB)=tr(PBU)$. So it suffices to prove that $tr(PBU)=tr(BUP)$. Therefore, we might as well assume that $A$ is positive. In this case we can let $P_n$ denote the spectral projection of $A$ onto $[1/n,\|A\|]$. Then $\lim_{n\to\infty} tr(P_nAB) = tr(AB)$. Now, for $T$ trace class $Q$ a projection we have $tr(QT)=tr(QTQ)=tr(TQ)$, whence $tr(P_n AB) = tr(P_n A P_n B P_n)$ since $P_n$ and $A$ commute. But the contraction $P_n B P_n$ of $B$ is trace class, for $P_n AB$ is trace class and the restriction of $P_n A$ to the range of $P_n$ is invertible. Thus $tr(P_n A P_n B P_n) = tr(P_n B P_n A) = tr(BA P_n)$ and consequently
$$ tr(AB) = \lim_{n\to\infty} tr(P_n AB) = \lim_{n\to\infty} tr(BAP_n) = tr(BA), $$
as desired.

Finally, here is the flawed proof.

Let $\{e_i\}$ be an orthonormal basis for $H$. Then
$$ tr(AB) = \sum_i \langle ABe_i, e_i \rangle = \sum_i \langle Be_i, A^\ast e_i \rangle. $$
But $\langle Be_i,A^\ast e_i \rangle = \sum_j \langle Be_i, e_j\rangle \overline{\langle A^\ast e_i, e_j\rangle}$, and therefore
$$\begin{align}
tr(AB) &= \sum_i \sum_j \langle Be_i, e_j\rangle \overline{\langle A^\ast e_i, e_j\rangle} \\
&= \sum_i \sum_j \overline{\langle B^\ast e_j, e_i\rangle} \langle A e_j, e_i \rangle \\
&= \sum_j \sum_i \overline{\langle B^\ast e_j, e_i\rangle} \langle A e_j, e_i \rangle \qquad (???) \\
&= \sum_j \langle Ae_j, B^\ast e_j \rangle \\
&= \sum_j \langle BAe_j, e_j \rangle \\
&= tr(BA).
\end{align}$$