OK Try this...
1. When the laptop is booting go into BIOS.
2. Next go to "Power Management" and look for "Wake on AC" or "Power on AC".
3. Here you want to disable, or unclick, this option and you should be good.
NOTE: The wording may be different on your device, but this should change it so the laptop doesn't turn off when plugged in.