iPhone says that the device is not supported if the charging port is dirty or damaged or if the charger is damaged or not Apple-certified. It can also say so if the USB cable you use isn’t meant for charging.
You can restart the iPhone and try using a different cable to solve this. You can also try cleaning the charging port and updating the iOS version on your iPhone.