Display is always Active while Phone is charging
You might have accidentally switched on don't turn off display in developer settings.
Check there otherwise the mods will tell you what to do
Devloper Option is not yet Enable on this Device.
Enable Developer options, toggle this setting and check behaviour when charging, disable Developer options.
Write how it turned out and do not forget to mention what version of Android you use, it is necessary to mention in every query.
If you have Android 10, describe how you upgraded to it and whether you performed a factory reset.
As mentioned there could be a host of reasons;
1. Do you have screen saver "on"?
2. Can you enable Developer Settings;
Settings->System->About Phone -> Software Information -> Press Build Number "many times"
Check for "Stay awake" toggle, it is near the top - is it enabled? If so, disable it.
3. Could the reason be any app keeping it alive when charging? That activated this flag somehow.