If we consider ideal diodes in the bridge rectifier without the capacitors, the voltage at the input of the 7805 would be the absolute value of a sine of 50Hz (i.e. positive parts of a sine wave repeating at 100Hz).
So 100 times per second the voltage is 0V, and the 7805 hasn't any voltage at the input, so it can't generate voltage at the output. Very bad if you want a regulated 5V at the output.
If you now add a large value capacitor (the 1000µF electrolytic capacitor), then it will be charged when the half sine is at its maximum, but only discharge very slowly when the half sine is near zero (it can't discharge through the diodes, so it is just discharging through the 7805).
This way, if the capacitor is big enough, it can provide the current needed by the 7805 while the half sine voltage is too low.
You can use a very large capacitor to get a nearly constant voltage, or somewhat smaller one so that the voltage will decrease on each half-cycle until just above the minimum voltage needed by the 7805 to keep delivering 5V.
The second solution is cheaper (smaller capacitor), the first one might provide a little bit cleaner regulated 5V (it depends on the quality of the regulator: some are quite sensible at changes in input voltage (a few %), others are extremely stable.
For the 0.22µF, its goal is different: it's not so much about storing a lot of energy, but rather about filtering high frequencies/allowing rapid adaptations to change in current demand. Electrolytic capacitors are notoriously bad at high frequency (above 100kHz-1MHz), so often we add a small ceramic capacitor in parallel, that stores less energy, but is very good at high frequencies.