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.