Let ring $R:=M_2(\mathbb F_p)$, where prime $p\ne 2$. There are two interesting equations $A^2=B^2$ and $(A+B)(A-B)=0$, and the numbers of solution pairs $(A,B)\in R^2$ of the equations are denoted $S_1(p),S_2(p)$.
The fun fact is that, I used a computer search and found $S_1(p)=S_2(p)$ for very small $p$-s. Actually: $$ S_1(3)=S_2(3)=417,\ S_1(5)=S_2(5)=4705,\ S_1(7)=S_2(7)=23233,\ S_1(11)=S_2(11)=202081. $$
And if we set $R:=M_2(\mathbb Z/p\mathbb Z)$ where $p$ may be a general odd number, we even have $S_1(9)=S_2(9)=123201$. So $S_1=S_2$ seems to be true in some more general settings. But I can't find any patterns in these numbers $S_i$ by just looking at them or using an OEIS check.
Let's name the equations (1) and (2) respectively. For (1), I've tried to use $A=X+Y,B=X-Y$ to rewrite it as follows, $$ (X+Y)^2=(X-Y)^2 \iff 2(XY+YX)=0, $$ since $R$ is not commutative. And by $p$ is odd, we eventually get $ab+ba=0$. And for (2), a similar argument reduce it to $XY=0$. But I still can't see how can one relate a solution of $XY+YX=0$ to a solution of $XY=0$. Is there any magic behind this?
Also, there would be no similar results for $M_3(\mathbb F_3)$, in that case $S_1=221157$ and $S_2=496341$.
Update
The above is the original problem. By a careful case-by-case discussion over the trace and rank of one of the matrix $X$ or $Y$, as suggested by the answer or the comment, we find the two equations $XY+YX=0$ and $XY=0$ both have $p^5+3p^4-2p^3-2p^2+p$ solutions.
But there are similar and more shocking phenomena: for a positive integer $n>0$, the following equation $$ f_n(X,Y)=XY-YX-X^n=0 $$ always seems to have $2p^4-p^2$ solutions no matter what $n$ is, coprime to $p$ or not. This sequence is OEIS $\mathsf A2593$. But there seems to be nothing related to our problem on that link page.
Another Update
Thanks to @user1551. For the new equation $f_n(X,Y)=0$ when $n\ge 2$, there is now some shortcut to see the result by linear algebra. By the fact that $[X,Y]$ commutes with $X$ (since $[X,Y]=X^n$), Jacobson's Lemma implies that $[X,Y]$ is nilpotent and $X$ is nilpotent too under our field characteristic condition. Because $X\in R$ is a $2\times 2$ nilpotent matrix, we have $X^n=0$ when $n\ge 2$. So solution sets for $n\ge 2$ are the same since $f_n(X,Y)=0$ iff $[X,Y]=0$ and $X$ is nilpotent.
When $n=1$, we know now $[X,Y]=X$ is nilpotent. Notice that this equation has at least one solution $Y_0$ for each given nilpotent $X$ (consider $X$ to be a Jordan form and construct $Y$ directly). After $Y\mapsto Y+Y_0$, equation $[X,Y_0+Y]=X$ becomes $[X,Y]=0$. This build a correspondence between the $n=1$ case and the $n\ge 2$ case.
We just compute the number of pairs $(a,b)$ with $ab=0$, $a,b\in M_2(F_p)$. Every nonzero matrix $M_2(F_p)$ with determinant $0$ is similar to one of the matrices $$ u=\begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix},\ v=\begin{pmatrix} \alpha & 0 \\ 0 & 0 \end{pmatrix}, $$ where $\alpha\in F_p$ and $\alpha\neq0$. For brevity, let $G=GL_2(F_p)$. We have $$ C_G(u)=\{g\in G\mid gu=ug\}=\left\{ \begin{pmatrix} \beta & \gamma \\ 0 & \beta \end{pmatrix}\mid \beta\in F^*,\gamma\in F_p \right\}, $$ $$ C_G(v)=\{g\in G\mid gv=vg\}=\left\{ \begin{pmatrix} \beta & 0 \\ 0 & \gamma \end{pmatrix}\mid \beta,\gamma\in F^* \right\}. $$ The number of matrices similar to the first of them is $$ |G:C_G(u)|=\frac{|G|}{|C_G(u)|}=\frac{(p^2-1)(p^2-p)}{p(p-1)}=p^2-1. $$ The number of matrices similar to $v$ is $$ |G:C_G(v)|=\frac{|G|}{|C_G(v)|}=\frac{(p^2-1)(p^2-p)}{(p-1)^2}=p(p+1). $$ Now we compute the number of matrices $y$ such that $uy=0$ and the same for $v$. $$ A_u=\{y\in M_2(F_p)\mid uy=0\}=\left\{ \begin{pmatrix} \beta & \gamma \\ 0 & 0 \end{pmatrix}\mid \beta,\gamma\in F_p \right\}\Rightarrow\ |A_u|=p^2, $$ $$ A_v=\{y\in M_2(F_p)\mid vy=0\}=\left\{ \begin{pmatrix} 0 & 0\\ \beta & \gamma \end{pmatrix}\mid \beta,\gamma\in F_p \right\}\Rightarrow\ |A_v|=p^2. $$ It follows that the set $W=\{(x,y)\in M_2(F_p)\times M_2(F_p)\mid xy=0 \}$ has exactly $$ |W|=(p^2-1)p^2+p(p+1)(p-1)p^2+p^4+(p^2-1)(p^2-p)\\=p^5+3p^4-2p^3-2p^2+p. $$ elements.
The number of elements of the set $$ W'=\{(x,y)\in M_2(F_p)\times M_2(F_p)\mid xy+yx=0\}. $$ is computed in the same way