Here's a simple proof that assumes OP knows how to telescope a finite geometric series and take a limit of a (complex) scalar sequence.
main idea is observing:
$\text{trace}\Big(\big(AB\big)^k\Big)=\text{trace}\Big(\big(BA\big)^k\Big)$
for $k \in\{1,2,3,...\}$
and the below proves that if traces of two $\text{n x n}$ complex matrices match for all powers of $k$, then the two matrices have the same eigenvalues. (With a lot more work the below can be developed into Newton's Identities though that seemed outside the scope.)
with $AB$ having distinct eigenvalues $\lambda_{AB}=\{\lambda_1, \lambda_2, ..., \lambda_d\}$ and $BA$ having distinct eigenvalues $\lambda_{BA}=\{\gamma_1, \gamma_2, ..., \gamma_r\}$. Between the two sets, there is a maximum modulus eigenvalue denoted $\sigma$. And for purposes of ordering, in each case the ordering is from smallest modulus to largest.
$x \in \mathbb C, \big \vert x\big \vert \gt \sigma$
i.e. $x$ may be any value on the complex plane outside the circle with radius $\sigma$ (that is centered at the origin)
$\sum_{k=1}^d\alpha_k\frac{1-(\frac{\lambda_k}{x})^m}{1-\frac{\lambda_k}{x}} =n + \sum_{k=1}^{m-1} \text{trace}\Big(\big(\frac{1}{x}AB\big)^k\Big) =n + \sum_{k=1}^{m-1} \text{trace}\Big(\big(\frac{1}{x}BA\big)^k\Big)=\sum_{j=1}^r\beta_j\frac{1-(\frac{\gamma_j}{x})^m}{1-\frac{\gamma_j}{x}}$
where $\alpha_k$ and $\beta_j$ are positive integers, i.e. denoting the algebraic multiplicities of the eigenvalues. Taking limits as $m\to \infty$
$\sum_{k=1}^d\alpha_k\frac{1}{1-\frac{\lambda_k}{x}}= \sum_{j=1}^r\beta_j\frac{1}{1-\frac{\gamma_j}{x}}$
suppose WLOG that $\vert \lambda_d\vert =\sigma$ and multiply each side by $(1-\frac{\lambda_d}{x})$
$LHS=(1-\frac{\lambda_d}{x})\sum_{k=1}^d\alpha_k\frac{1}{1-\frac{\lambda_k}{x}}= (1-\frac{\lambda_d}{x})\sum_{j=1}^r\beta_j\frac{1}{1-\frac{\gamma_j}{x}}=RHS$
take a limit as $x\to \lambda_d$ e.g. sequentially $x_t = (1 +\frac{1}{t})\lambda_d$
$0\lt \alpha_d= \lim_{x\to \lambda_d}\sum_{j=1}^r\beta_j(1-\frac{\lambda_d}{x})\frac{1}{1-\frac{\gamma_j}{x}}$
but $\lim_{x\to \lambda_d}(1-\frac{\lambda_d}{x})\frac{1}{1-\frac{\gamma_j}{x}}= 1$ iff $\gamma_j = \lambda_d$ and 0 otherwise.
Thus there is a maximum modulus eigenvalue in common with the same algebraic multiplicities and the labeling (other than for modulus purposes) is arbitrary so assume WLOG that $\gamma_r = \lambda_d$. Thus $\beta_r = \alpha_d$. Now recurse on the strictly smaller subproblem
$LHS=\sum_{k=1}^{d-1}\alpha_k\frac{1}{1-\frac{\lambda_k}{x}}= \sum_{j=1}^{r-1}\beta_j\frac{1}{1-\frac{\gamma_j}{x}}=RHS$