Q:

What does the subscript of atomic orbital mean?

As everyone knows, the atomic orbital can be classified as $s, p_z, p_x, p_y, d_{z^2},d_{xz},d_{yz},d_{xy},d_{x^2-y^2}$ and so on. I want to know the meaning of $z^2,x^2-y^2$ and so on. Maybe this is a fundamental question, but I'm not familiar with chemistry.

I have some ideas about this:

For example, we consider the $p$ orbital: $p_z$ is symmetric about $z$ axis; $p_x$ is symmetric about $x$ axis; $p_y$ is symmetric about $y$ axis. But what's the meaning of $z^2$ or $x^2 -y^2$?
We consider the symmetry of atomic orbital with group theory. The change of orbital under the symmetry operation is the same as the orbital subscript.

A:

For each azimutal quantum number $l$, the magnetic quantum number $m$ ranges from $-l$ to $+l$. Those give you the number of atomic orbitals "subsripts" you should obtain.
Those are then expressed using spherical harmonics. If you look at the table of spherical harmonics at the $l=1$, you will find that they contain the cartesian axes as $x-y$, $z$ and $x+y$. Therefore it is advisable to form the linear combination out of them, so you get $x$, $y$, $z$. If you go to higher angular momentum, things get more complicated, but there is some tradition what linear combinations to use.
To answer your second question, all this formulas are not some inevitable result you obtain by juggling the numbers. Contrary, it is carefully crafted in a way that the formulas are so simple.

