You're saying when you plug in the external power supply it makes the laptop restart? Does this just happen one time when you connect?
Are you using the original power supply or a replacement supply?
Try plugging into the laptop first and then plugging in the AC to the wall. Try it the other way around and see if it matters.
I have original power adapter in my hand and I purchased another one online. Both have the same issue . It’s restarting uneven time frame, sometimes it works an hour then restarts and sometimes it restarts after 5 minutes. When I take out the adapter and it’s works perfectly on battery till the charge completes. What’s the issue. Thanks
Now I understand. Since you are using the real power adapter and have the same problem with another adapter, it points almost certainly to a problem with the power circuitry inside the laptop. Most power supplies (I'm talking about inside the laptop) are built with monitoring circuitry such that if one on the power supply output voltages goes out of tolerance, a reset signal is generated. This would cause your machine to restart. Why that is happening I couldn't guess but I would be thinking there is a problem with the motherboard (that is where the internal power supply lives). Sorry I can't be more helpful. Having random restarts is not only annoying but can mess up the system software sometimes (rarely).