There’s four different means by which an iPhone and charger can communicate, USB-PD, USB-BC, “old school” USB, and Apple’s own BrickID. Each standard has it’s own limits and quirks.
Plugging an iPhone into an Apple 20 watt USB-C charger should be just as good or better than plugging into an Apple computer with a USB-C port. Apple specs show that most any Apple computer with USB-C will be able to supply 15 watts from it’s USB-C port. Connecting an Apple to an Apple should mean they talk all the same languages. With 15 vs. 20 watts you may not even notice a difference in charging time, at that point the Lightning port may be the limiting factor. Apple won’t say exactly how much power Lightning supports but testing shows it is likely 18 watts, or at least that is my recollection. Getting a bigger power supply than what Lightning supports won’t charge the iPhone any faster. A bigger power supply could actually charge slower than a “medium sized” power supply for reasons that get very technical very quickly, reasons that I’m not sure we need to go into.
It would not surprise me to see a 3rd party charger or computer charge an iPhone slowly as that could be explained by the devices not speaking the same language. Without support for iPhone “fast charging” any charging device would fall back to the “old school” USB spec of 5 watts (or is it 4.5 watts? I forget and it’s a tiny difference regardless) which would make the charging easily 3 or 4 times longer.
My first suspicion would be that the power supply is damaged but it sounds like this may have been ruled out. If that’s not the problem then perhaps the iPhone is somehow damaged. The iPhone may have a bad wire in it somewhere or a software problem preventing communication with the power brick. When any USB device is plugged in it goes into “old school” mode for backward compatibility, once the iPhone and charger communicate their capability properly then and only then should more power flow. If more power flows than the communication allows then we tend to see things damaged and potentially people hurt.