Chosen Solution

Surfing the internet while my macbook laptop was charging, it suddenly turned itself off with a soft pop sound (the laptop didn’t seem to be hot as far as I could tell). When I turned it back on there was a burnt smell coming from it (not from the charger) for a few minutes but now everything seems to be working fine (can still charge it, connect it to wifi, connect usb devices to it). What possible things could have caused it?

Without inspection of the logic board its anyones guess! You likely blew a capacitor. Compare with the pictures here MacBook Pro 15" Retina Display Mid 2015 Logic Board Replacement you may need to take the logic board out.