Yes nullity is same as dimension of null space.
Observe that if $A$ and $B$ are similar then $\exists \, P$ such that $A=PBP^{-1}$. Using this we can also say that $A-\lambda I=PBP^{-1}-\lambda I = P(B-\lambda I)P^{-1}$. This means both $A-\lambda I$ and $B-\lambda I$ are also similar. So to prove what you have asked it is enough to show that the nullity of similar matrices is same. So here is an outline to show that if $A$ and $B$ are similar then there nullities will be same.
Let us assume there exists an invertible matrix $P$ such that $B=PAP^{-1}$.
Let $S=\{x_1,x_2, \ldots, x_k\}$ be a basis of the null space $N(B)$, then $Bx_i=0$ for all $i \in \{1,2,3, \ldots, k\}$. Observe that
\begin{align*}
Bx_i & = 0 \\
PAP^{-1}x_i & = 0\\
A(P^{-1}x_i) & = 0
\end{align*}
Thus the set $\{P^{-1}x_1, P^{-1}x_2, \ldots, P^{-1}x_k\} \subseteq N(A)$. You can easily show that this set is linearly independent. Now if we can show that $\text{span}\{P^{-1}x_1, P^{-1}x_2, \ldots, P^{-1}x_k\}=N(A)$, then we are done.
Let $y \in N(A)$, then $Ay=P^{-1}BPy=0$. This means $Py \in N(B)$. Thus $Py=c_1x_1+c_2x_2+ \dotsb + c_kx_k$ for some scalars $c_i$. Now multiply both sides by $P^{-1}$.
Here is a $2\times 2$ counterexample, easily extendable to $n\times n$: Let $A$ orthogonally project onto one axis, and let $B$ rotate the plane by $90^\circ$. The operation of $ABA$ is to collapse everything down to one axis, then turn that axis, then collapse that axis down to the origin. However, $A^2 = A\neq 0$.
Specifically, $A = \left[\begin{smallmatrix}1&0\\0&0\end{smallmatrix}\right]$ and $B = \left[\begin{smallmatrix}0&-1\\1&0\end{smallmatrix}\right]$.
Best Answer
This isn't true. Consider e.g. a field of characteristic $\ne2$ with $$ A=\pmatrix{1&1\\ 0&0}, \ B=\pmatrix{0&1\\ 0&1}, \ AB=\pmatrix{0&2\\ 0&0}\ne0=BA. $$