T1 steps the mains down to 12 V AC and isolates the rest of the circuit from it. F1 on the primary blows if the transformer or anything after it fails short. A 12 V RMS winding peaks at about 12 V × √2 ≈ 17 V.
BR1 holds four diodes in the diamond of a full-wave bridge. When the top of the secondary is positive, current flows through the upper-right diode to the + corner, through the load and back to the − corner through the lower-left diode. On the other half-cycle it flows through the lower-right and upper-left diodes. Either way the + rail only ever sees positive pulses, two per mains cycle, and two diode drops are lost on the way: about 15.6 V at the peak.
C1 charges to the peak of each pulse and feeds the load in between, so the voltage sags only a little before the next pulse tops it up. That sag is the ripple, about I / (2fC): 2.3 V at 0.5 A on 50 Hz mains, or 1.9 V on 60 Hz.
The 7805 needs its input a couple of volts above its output; check the dropout in your regulator's datasheet. Here the input never falls below about 13 V, so the output holds at 5 V. The cost is heat: the regulator burns off the difference, about 4.7 W at 0.5 A, so it needs a heatsink. C2 at the output improves the regulator's response to sudden changes in load.