To summarize, it is important to remember P1 chooses his strategies based on his type and P2 chooses his strategies based on P1's choice.
So for example the strategy $AB$ for P1 means, if I am type 1 (left side of the graph) choose $A$ as an action, if I am type 2 (right side of the graph) choose $B$ as an action. Remember, P1 observes his type based on Natures probabilities of being type 1 or type 2. For P2, the strategy $XY$ would mean, if P1 plays $A$ play $X$, if P1 plays $B$ play $Y$. P2 does not know what P1's type is so his strategies must be based on P1's actions.
Since we don't know what side we are on because this always decided by Nature, there will always be two possible payoffs for any situation. Meaning, we need to calculate each player's expected payoff based on a situation.
Let's calculate a few to demonstrate this. If P1 plays $AA$, we are essentially in the top part of the graph as regardless of his type, he will play $A$. Now if P2 plays $XX$, he is basically saying, whatever action P1 takes, I'll play $X$, so this leaves only the $X$ branches to consider. And since we are only in the top part of the graph, the branches to consider are the $X$ branches yielding a payoff of (1,1) and (0,0). The expected playoff of P1 is $u_1 = 1 \times q + 0 \times (1-q) = q$ and for P2 it is
$u_2 = 1 \times q + 0 \times (1-q) = q$.
Using the same logic we can repeat this for all 16 scenarios. Here are a few more examples:
- $BA$ and $YX$ results in $u_1=u_2=1 \times q + 1 \times (1-q) = 1$
- $AB$ and $XY$ results in $u_1=u+2= 1 \times q + 1 \times (1-q) = 1$
Computing these for all the strategy profiles, we can create the following normal form representation:
$$
\begin{array}{c|lcr}
& \text{XX} & \text{XY} & \text{YX} & \text{YY} \\
\hline
AA & q,q & q,q & 1-q,1-q & 1-q,1-q \\
AB & q,q & 1,1 & 0,0 & 1-q,1-q\\
BA & q,q & 0,0 & 1,1 & 1-q,1-q\\
BB & q,q & 1-q,1-q & q,q & 1-q,1-q
\end{array}
$$
Big thanks to Henry and Henning for providing intuition for this understanding.