Normally if the device gets stuck on the Apple logo then it tends to indicate something is wrong with the operating system that’s preventing the device from booting, to fix you would connect to iTunes and Restore the device (using Recovery Mode).
If your iPhone, iPad, or iPod touch won't turn on or is frozen - Apple Support
But you say it only happens when the device is connected to power, when not it’s dead, that would probably point to a battery issue and if you can’t turn the device on you can’t look at Settings>Battery>Battery Health to check percentage to confirm that possibility.
I can’t think of anything else the user can do under these circumstances so you might be wise to make a Genius appointment so Apple can test the hardware.