If you find yourself in a situation where your Android shows the charging sign when connected to a power source and doesn't only not charge but the battery actually drains then here are a few fixes
It's possible that the charger is defective / not powerful enough. Consider trying another charger
Try removing the battery for 15 seconds then slotting back in
Disable battery consumer(s)
Go to Settings > Battery and check for the biggest battery consumers. Take necessary actions
Do a factory reset in recovery mode.
The battery might be worn out. Test a different battery.
Revert to stock ROM
If flashing a custom ROM resulted in this issue then consider reverting to the stock ROM
Check USB port
The USB port might be clogged with dust or broken.