I get asked somewhat regularly whether the shaver socket that’s buzzing is dangerous and the short answer is no, it’s not.
Shaver sockets, among other items such as USB sockets use something called a transformer. Transformers are usually used to transform voltages, a good example will be changing voltages from powerlines from hundreds of thousands of volts down to 230 volts which is what our homes use. Inside transformers is a series of windings around a metal core and the buzzing you hear is the result of the alternating magnetic fields from the AC voltage.
It's usually nothing to worry about and is generally considered normal and the noise will change depending on the amount of current flowing through it, which isn’t a lot when it comes to shaver sockets!
If the buzzing becomes louder over time or the unit is generating a lot of heat it could be an indication of the insulation beginning to fail or a fault that has developed within the transformer. In this case you’d be best speaking to a registered electrician to investigate it further.