$$\big\| \mathrm A \begin{bmatrix} \mathrm X & \mathrm X^2\end{bmatrix} - \begin{bmatrix} \mathrm B_1 & \mathrm B_2\end{bmatrix} \big\|_{\text{F}}^2 = \underbrace{\| \mathrm A \mathrm X - \mathrm B_1 \|_{\text{F}}^2}_{=: f_1 (\mathrm X)} + \underbrace{\| \mathrm A \mathrm X^2 - \mathrm B_2 \|_{\text{F}}^2}_{=: f_2 (\mathrm X)}$$
Everybody knows that
$$\nabla f_1 (\mathrm X) = 2 \, \mathrm A^\top \big( \mathrm A \, \mathrm X - \mathrm B_1 \big)$$
The challenge is to compute $\nabla f_2 (\mathrm X)$. Since $f_2$ is quartic in $\mathrm X$, the gradient $\nabla f_2$ should be cubic.
$$f_2 (\mathrm X + h \mathrm V) = \cdots = f_2 (\mathrm X) + 2 h \, \mbox{tr} \big( \left( \mathrm X \mathrm V + \mathrm V \mathrm X \right)^\top \mathrm A^\top \left( \mathrm A \mathrm X^2 - \mathrm B_2 \right) \big) + o (h^2)$$
Computing the directional derivative of $f_2$ in the direction of $\mathrm V$ at $\mathrm X$,
$$\lim_{h \to 0} \frac{f_2 (\mathrm X + h \mathrm V) - f_2 (\mathrm X)}{h} = 2 \, \mbox{tr} \big( \left( \mathrm X \mathrm V + \mathrm V \mathrm X \right)^\top \mathrm A^\top \left( \mathrm A \mathrm X^2 - \mathrm B_2 \right) \big)$$
Extracting the gradient $\nabla f_2 (\mathrm X)$ from the (Frobenius) inner product,
$$\boxed{\nabla f_2 (\mathrm X) = 2 \, \mathrm X^\top \mathrm A^\top \big( \mathrm A \,\mathrm X^2 - \mathrm B_2 \big) + 2 \, \mathrm A^\top \big( \mathrm A \,\mathrm X^2 - \mathrm B_2 \big) \mathrm X^\top}$$
which is indeed cubic in $\rm X$. Using the anticommutator,
$$\nabla f_2 (\mathrm X) = \big\{ \mathrm X^\top, 2 \, \mathrm A^\top \big( \mathrm A \,\mathrm X^2 - \mathrm B_2 \big) \big\}$$