$ALA^{-1}=X=Y=BMB^{-1}$
$L=A^{-1}BMB^{-1}A=\left(B^{-1}A\right)^{-1}M\left(B^{-1}A\right)$
From this, it's fairly obvious that the answer is no. We just need to take $B^{-1}A$ so that it doesn't commute with $M$.
Let's take $A=\begin{pmatrix}1&0\\0&1\end{pmatrix}=A^{-1}$
$L=X=Y=BMB^{-1}$
We just need $M$ that doesn't commute with $B$.
$M=\begin{pmatrix}0&1\\1&0\end{pmatrix}$
$B=\begin{pmatrix}1&0\\0&-1\end{pmatrix} = B^{-1}$
The idea here is that we scale differetly the first and second coordinates with $B$ so since $M$ swaps them, we won't get the same result if we swap them before or after. So they don't commute.
Then you can just compute $L=BMB^{-1}=-M\not=M$ (you're working in $\Bbb R$ or $\Bbb C$, aren't you?)