Are there any special rules when making a substitution in an integral?

This is a great question, and I find that variants are often poorly understood. Let's carry out the substitution completely. Since $a$ clearly doesn't matter, I'll suppose that $a = 1$ for simplicity.

$$ \int_{-1}^1 x^2 dx = \frac{1}{2} \int_{-1}^1 x \cdot 2x dx.$$

In this form, we substitute $u = x^2$, so that $du = 2x dx$. Then in the integral, we have

$$ \frac{1}{2} \int_{-1}^1 \underbrace{x}_{\pm\sqrt u} \cdot \underbrace{2x dx}_{du}.$$

To complete the substitution, we need to substitute $x = \pm \sqrt u$. I write $\pm$ to indicate that sometimes we have $x = \sqrt u$ and sometimes we have $x = - \sqrt u$. In particular, when $x$ is negative, we choose the negative square root, $x = - \sqrt u$. This ambiguity is very important.

Namely, for $x$ in $[-1, 0]$, we have that $x = -\sqrt u$ and for $x$ in $[0, 1]$ we have that $x = \sqrt u$. Then to perform the substitution, we split the integral into these two intervals and handle each separately.

$$\begin{align} \frac{1}{2} \int_{-1}^1 x \cdot 2x dx &= \frac{1}{2} \int_{-1}^0 x \cdot 2x dx + \frac{1}{2} \int_{0}^1 x \cdot 2x dx \\ &= \frac{1}{2} \int_1^0 (- \sqrt u) du + \frac{1}{2} \int_0^1 \sqrt u du \\ &= \frac{1}{2} \int_0^1 \sqrt u du + \frac{1}{2} \int_0^1 \sqrt u du \\ &= \int_0^1 \sqrt u du = \frac{2}{3} u^{3/2} \bigg|_0^1 = \frac{2}{3}. \end{align}$$

The exact nature of the substitution is very important. This causes some introductory texts to state that substitutions must be injective. But a careful analysis shows otherwise. $\spadesuit$