Generally, you can charge the phone with the case on. However, there are some details that need to be considered.
Heat: If the phone case is made of a heat-retaining material, it can cause the phone to overheat while charging. Overheating damages the battery, so it's important to monitor the phone's temperature while charging.
Wireless charging: If you're charging your phone in a wireless charging case, make sure the case is compatible with this form of charging. In some cases, it may interfere and not provide enough power to charge the phone.
Charging with a plug: Phone cases can prevent the plug from properly connecting to the charging port, causing the phone to not charge properly.
However, if the phone case doesn't seem to cause a problem, you may not remove it, but be sure to check the heat because it is an important factor that affects battery life and performance.