When you tried to start your engine the low battery caused the starter relay contacts to weld closed.
That caused the starter to try to run until the battery was completely discharged.
Then, when you put the charger on the battery, I bet you still had the battery connected to the bike. That caused all the current from the charger to just go to the starter through the welded relay contacts.
You need to get the relay contacts unstuck before you put the battery on the charger.
Don't use a trickle charger/maintainer. They don't put out enough current to charge a dead battery. You need a charger that puts out at least 4 amps.
Last, if your battery has been sitting for more than a month or two with a low charge there is a good chance the plates are sulfated, and it will not reliably hold a charge anymore. Be prepared to buy a new battery.