Supplying an MCU from 110 or 220V line
A typical USB charger will use a reduced-size version of a switch-mode power supply (SMPS). This kind of power supply has an isolated, low-voltage output called a SELV, or Safety Extra Low Voltage. Supplies of this type are 'touch-safe', meaning their isolation and low voltage means that contact with the secondary poses almost no hazard (leakage is below 3mA.)

Wall-wart DC supplies are also SELV type. These can be SMPS or traditional step-down transformer type.

As to "what's inside", an off-the-line SMPS is a collection of components. The main ones are the input bridge to make DC, a switching controller, a flyback pulse transformer, and an output circuit. The transformer is key to making it safe to use, as it provides isolation for the secondary.

Pre-made modules that accept 110/220V on wires and make 3.3V output are available and common, which meet SELV isolation limits.

But I recommend another approach. Use a step-down transformer (12 ~ 24VAC) to supply a pig-tailed AC-DC 5V regulator. This kind of low voltage AC wiring is popular for controls like thermostats, doorbells, sprinkler valves, patio lights, etc., so it's cheap and easy to find. It's popular for home automation stuff.

Why do it this way? You avoid the issue of running 220V to your system. This will be safer to work with than using straight off-the-line to your power supply board.

This kind of 12 ~ 24V AC transformer is a common item called a 'bell transformer'. There are even versions that mount directly onto a junction box in place of a cover plate, so it does double duty of covering over the primary voltage wiring, and providing the safe, low-voltage secondary for your use.