Hi @wiiyz
It may be that the battery is failing and the charger can't do both when the laptop is turned on i.e. run the laptop and charge a failing battery at the same time.
Create a [https://www.windowscentral.com/generate-battery-report-windows-10|battery report] to check the condition of the battery.
When you have the report, compare the ''Design Capacity'' value versus the ''Full Charge Capacity'' value in the report. For a good battery they will nearly be the same value. You can calculate the current battery condition as a percentage of its original factory condition by using the formula: ''Full Charge value x 100 ÷ Design Capacity value.''
If the current condition is <40% you may wish to consider replacing the battery soon