Does that occur regardless of the USB-C port being used for the power adapter? Definitely try it with a USB-C port on the other side of the laptop.
You can try an SMC Reset (make sure to read the instructions carefully since the process has changed for the T2 Macs).
Make sure to disconnect all other external devices in case one of them is causing a problem.
Unplug the power adapter from the electrical outlet for a minute to reset the power adapter's internal circuitry. Here is an Apple article with some troubleshooting tips:
If your USB-C power adapter isn't charging your Mac laptop - Apple Support
If you still have the issue occurring regardless of the USB-C port being used, then you have some sort of hardware issue. Either that battery has a problem, or one or both I/O Boards have a problem, or the Logic Board is bad. I guess the USB-C charging cable or power adapter could also have a problem.
Personally I would not spend any money to repair any 2016-2020 Intel Macs with USB-C ports for multiple reasons. The money spent on repairs is better put towards a new laptop in my opinion. I'm normally a person who tries their best to keep older equipment running so it pains me to say it.