Loud noise charging Macbook Pro USB-C
This is something you could record with a phone (or perhaps the Mac itself) and then open a support case directly with Apple. This sort of thing could be a firmware update needed or failing hardware, but I’d hesitate to speculate on the cause of this without hearing the sound, but I’m sure it’s disconcerting to say the least.

I would be sure to apply all system updates and possibly download the High Sierra installer and run it to be sure all firmware updates are applied on your Mac if opening a support case isn’t getting a quick response.