it runs very slow in the BIOS settings too.
That means the issue is not a software issue.
Attaching the charger could be disconnecting the battery - hardware issue. The machine needs the battery with the charger to run at proper speed.
It is possible the battery circuit (or battery itself) has a hardware issue as well.
You need to take the machine to a local service shop and have it repaired.