When charging my MacBook Pro (mid 2017, macOS Catalina 10.15.7) with the 61W USB-C Power Adapter from Apple, sometimes the "battery is not charging" warning start appearing from nowhere draining the battery.
There are a couple of possibilities that can be attributed to this:
Battery Health Management
This could be expected behavior. With the release of Catalina (10.15.5), there is a feature called Battery Health Management that will actually stop the charging of the battery at a certain battery charge range. This "battery not charging" message is perfectly normal when this function/feature is enabled.
Faulty USB Mux Chip
There have been reports that the USB Mux chip (TI CB3215) is faulty. This chip is what negotiates the charging power to be delivered from the USB-C (USB-PD compliant) power adapter. It starts off with a 5V nominal voltage, but then can go as high as 20V at about 3A (≅ 61W). The full spec calls for up to 20V @ 5A or 100W, but (obviously) can be lower due to a lower overall wattage rating.
This is expected given that the correct charger for the 2017 MacBook Pro is the 87W charger. See the Apple Support document Find the right power adapter and cable for your Mac notebook. If you use a power adapter with less than the required wattage, your MacBook will not be able to supply enough power for all of it's functions - charging and powering the computer. In this case, it was using all available power to run the laptop and there wasn't any left to charge the battery.
Your charger is likely good
When using the power adapter from Apple and the USB-C cable on another device (unfortunately a phone and not another MacBook), it's charging normally.
"Normally" is relative here. If it's from a MacBook and USB-C PD compliant (which Apple chargers are) it would be sufficient enough to charge the phone at what appears to be a "normal rate." Being that it's USB-C, it would conform to the USB Power Delivery Specification (USB-PD) where the current is negotiated to the highest possible. As mentioned earlier, it would start off at 5V then negotiate from there. As most phones use a 5V and a 2-2.5A charger anyway, even without negotiating power, the adapter is delivering the maximum (what the phone will draw) to charge the phone. This means your charger is likely working as it should. However, a proper test would be to try that charger on a different MacBook. If you see that it negotiates anywhere near it's full 61W, then you've confirmed it's viability.
When using another power adapter on the MacBook, it's charging slowly (but coming from a 12W power adapter and a USB-A to USB-C cable that seems fair enough).
This is also expected. Most USB-A chargers only supply up to 12 watts of power. There is no power negotiation with these chargers. When connected to your MacBook, it will receive the 5V from the adapter, the Mac will attempt to ask for more but since it will not get a response, it will just continue to draw the 12W available.
Some of this, as described is normal behavior if Battery Health Management is enabled. If you suspect your adapter, you can use aftermarket USB-C chargers with confidence but I always recommend getting quality adapters and cables from well known vendors like Anker, Belkin, StarTech, etc. However, there is the possibility that the USB mux chip that regulates the charging is failing or has failed. Apple will require a replacement of the logic board, but there are board repair facilities that can replace that single component.