A mobile charger is basically an Switch mode power supply(SMPS).

A mobile charger commonly contains a high frequency transformer, a full-wave rectifier, a high frequency switch and its control mechanism and filters.

I would suggest read up this article to understand full working on mobile chargers or SMPS in general.
1 5 1