How does this BJT transistor circuit works?
The zener with series resistor R3 has about 10V on the anode wrt ground. It is seeing 50mA so the actual voltage will be a bit higher than the 10V nominal, maybe one percent on average. 

That voltage is buffered with Q7 and used to create a ~17mA current source for the current mirror composed of Q6 and Q5, which feeds the differential amplifier composed of Q3 and Q4 (so bias currents are in the 50uA range). 

The differential amplifier is fed with 5V from the R4/R5 voltage divider (minus about 25mV from the bias current). Q1 and Q2 form a Sziklai pair voltage follower. 

The output voltage is divided down by R1/R2 (poorly matched to R4/R5) so that the output voltage should be about 21.7V at balance with 10V so maybe 22V with the 55mA zener current.  

This circuit could be improved by bootstrapping some the Zener current from the output to make it more constant (a resistor from output to the zener) and by making \$\dfrac{R1 \cdot R2}{R1+R2} \approx 500\Omega\$. The former improvement would improve line regulation (changes in output voltage with changes in input voltage), and the latter would improve temperature stability. Some emitter degeneration in the current mirror would also be a good idea (and coupling them together thermally). Also a resistor on the output pass transistor to deal with high-temperature leakage. 

It's going to run quite warm- the zener is dissipating over half a watt, and Q7 about a watt - above its rating without a heatsink. In a modern design we'd not likely be nearly that wasteful.