If I am correct, the Canon-supplied AC adaptor is the CA-570. Doing an internet search for "Canon CA-570" should yield several dozen responses.
If your current AC adaptor is not staying plugged in, then IMO, it is highly possible that one of two things is damaged.
1. The AC adaptor's barrel connector pin has suffered some form of damage. Like, it got stepped on.
2. The camera's power port that the connector pin plugs into has been elongated as would have happened if the barrel connector was yanked out at an angle.
Of course, long term usage could be the cause. That is one tiny barrel. Maybe a non-L shaped one would have been better.
Hopefully, it is just the AC adaptor's barrel pin is damaged. Then, a replacement will be your least expense.
If it is the camera's power port that is damaged, then either work out something to help it stay in. Use your imagination here. Maybe a a tiny bead of silicone sealant (or something else pliable) on only one side of the length of the barrel will do.This should allow the rest of the barrel's bare side able to press against the inside of the port maintaining power conductivity. I hope that made sense. Just a thought.
Or, send it in to get that part replaced.
For others who need to have the AC adaptor plugged in for longer time periods than the battery can support, I recommend tying or tethering part the cable so as to provide a strain relief. Just in case someone or something gets tangled in that near invisible cable wiring. But, again, maybe repeated instances of pulling out and inserting in the pin causes looseness.
I have had my Vixia HF G40 for 3 years, and it is still going strong and producing awesome videos that wow people.