changes A/C voltage. The stuff in the box needs electricity. The 120V outside is not the right 'voltage' for the stuff in the box. The transformer, the donut, changes the voltage to several (usually several) that the parts in the box can use.
Common voltages are 35V+ and 35V-, 12V+, 12V-, 6V etc.
Then SOME stuff needs direct current not A/C current so there are diodes and stuff to change it to direct current...
Every part in there does something important.
Toroidial transformers are the usual in better boxes, some new "R" Core transformers are coming out in stuff, and the 'old' standard transformer.
The best for each app is decided by the maker.
Common voltages are 35V+ and 35V-, 12V+, 12V-, 6V etc.
Then SOME stuff needs direct current not A/C current so there are diodes and stuff to change it to direct current...
Every part in there does something important.
Toroidial transformers are the usual in better boxes, some new "R" Core transformers are coming out in stuff, and the 'old' standard transformer.
The best for each app is decided by the maker.