Both answers here are very good, I only want to shed some light on how such a confusion had arisen for you. It seems it may have stemmed from a subtlety related to the following vector identity, to cite from the relevant Wikipedia entry:
The vector calculus identity of the cross product of a curl holds:
$$\mathbf{v} \times \left( \nabla \times \mathbf{a} \right) = \nabla_a \left( \mathbf{v} \cdot \mathbf{a} \right) - \mathbf{v} \cdot \nabla \mathbf{a} $$
where the Feynman subscript notation $\nabla_\mathbf{a}$ is used, which means the subscripted gradient operates only on the factor $\mathbf{a}$.
Now, perhaps counter-intuitively, what happens when you put $\mathbf{v}=\mathbf{a}$ is that the operator in $\nabla_a \left( \mathbf{v} \cdot \mathbf{a} \right)$ is still only acting on one of the vectors, and not both! This is reflected quite clearly in @basics' derivation of the identity in his answer here, namely the term $ b_m\partial_i b_m $ shows you only one of the pair of vectors under the $\nabla_a$ is being differentiated.
That's why in order to put them both under the same regular $\nabla$, we must write:
$$\nabla_a \left( \mathbf{a} \cdot \mathbf{a} \right) = \frac{1}{2}\nabla(\mathbf{a}^2) $$
Which establishes the correctness of your first equation.
The key takeaway as the other answers mention, is indeed not to try and apply regular vector identities to the $\nabla$ vector operator.
Not only triple vector identities like "BAC-CAB" fail when we try and do this, but even a basic identity that works for vectors like:
$$ \mathbf{A}\times\mathbf{B} = -\mathbf{B}\times\mathbf{A} $$
Makes completely no sense when we put $\mathbf{B}=\nabla$. When we do that, the LHS becomes $\mathbf{A}\times\nabla$, which is a vector operator, but the RHS, $-\nabla\times\mathbf{A}$ is still a vector!