Does it shut down if you remove the battery?
IS there any info in the event log?
The only thing that comes to mind is that there could be an unexpected voltage drop when the battery starts charging and that the PC is shutting down to protect itself.
If that’s the case (and it’s a big IF) the issue is likely one of the following.
1) The charger is damaged
2) The charging circuit is damaged
3) The battery is damaged.
If it runs without the battery in place I would buy a replacement charger since it’s the cheapest to replace.
If that didn’t fix it I would replace the battery.
If that didn’t fix it I would return both and treat my laptop as a desktop.