Defective battery? other internal component failure? but we, just users like you can't diagnose that kind of issue remotely, sorry.
If you already tried (to no avail) ALL the steps provided in this support article:--> If your iPhone or iPod touch won't charge - Apple Support , there are two basic troubleshooting steps to perform (test after each attempt):
A) If not already done, update your iPhone to the latest iOS version (now 18.3)
B) Try a "forced" restart of your device using these instructions: Put it on charge for at least half an hour, then, keeping it plugged in, use these gestures:
In rapid sequence, press and quickly release the volume up button, press and quickly release the volume down button, then press and hold the side (power) button. Only when the Apple logo appears (it might take 10-20 seconds), release that button (ignore all other screens that might appear, the one with the "slider" to turn the device off included).
If the issue still persists, I suggest that you contact Apple Support directly, using this link:--> Contact Apple for support and service , or make an appointment (*) and have your device inspected at an Apple Store or AASP (Apple Authorized Service Provider) among this list:--> https://locate.apple.com/choose-country-region . After checking it out, they'll give you all the available options.
Regards
Giulio
(*) You can do it: