Here is the question I am trying to solve from Allen Hatcher's book:
Compute the simplicial homology groups of the Klein bottle using the $\Delta$-complex structure described at the beginning of this section.
And here is the solution I found online for this question:
But I do not know how is the matrix P is found and why using Smith Normal Form ?



To answer your questions directly:
The columns of $P$ are taken from the coefficients of $a,b,c$ in the equations $$ \partial U = (1)a + (1)b + (-1)c,\\ \partial L = (1)a + (-1)b + (1)c. $$
The Smith normal form of an $m \times n$ matrix $P$ gives you a convenient way to identify the quotient $\Bbb Z^m/P(\Bbb Z^n)$ up to isomorphism (where $P(\Bbb Z^n)$ denotes the image of the map $x \mapsto Px$).