but I really struggle to motivate myself to go and let my gym
membership lapse as a result.
If you just want someone to go down the gym with you, just try to find someone else who will go with you, it sounds like it would be a lot easier and less painful for both of you.
If your objective is to make your GF lose weight, then stop and actually ask her if she actually wants to lose weight.
If she doesn't want to lose weight then don't try to force her to lose weight - accept her as she is. If you don't like her being overweight and you feel the need to change that then you might want to think whether you actually want to be in a relationship with her or not.
If she does want to lose weight but doesn't want to go down the gym then find a different way to do it. Pick a physical activity that you can both do and enjoy without thinking about the fact you're losing weight, or perhaps do something in private so she doesn't have to worry about a load of strangers passing judgement on her, e.g. get a rowing machine or a treadmill.
I think it would be good for both me and her to go to the gym
regularly and I actually think if she got into it it would increase
her self-esteem a lot and reduce the insecurity
I'd be interested to know why you think this.
Insecurity about appearance doesn't come from being stereotypically ugly, it comes from fear of other people's opinions and fear of judgement by society for not being stereotypically attractive. Some people can look as stereotypically pretty as possible and still be insecure about their appearance. Often the best answer is not to change one's appearance, but to change one's outlook.
I qualify 'stereotypically' here, because beauty is in the eye of the beholder. People find different features attractive, i.e. there are people who find overweight people attractive and skinny people unattractive despite that not being the social norm.
So how can I go about asking her to be my gym buddy without hurting
her feelings, and with a decent chance she'll say yes?
To reiterate, you can't make her go unless she actually wants to. You need to ask yourself "why do I want her to do to the gym?".
If the answer is "for health reasons" then make sure you're not jumping the gun, she might already be adequately healthy, often diet is a bigger contributor to health than how active someone is. If she is unhealthy then you still need to ask if she wants to be healthy (not everyone cares about their health), and if she does then the answer isn't necessarily the gym - you should consult a health professional.
If the answer to "why do I want her to go to the gym?" is "to improve her self esteem" then consider seeing a psychiatrist/councellor instead. Self esteem problems are usually psychological issues that won't go away just by looking stereotypically attractive. Even stereotypically attractive people can have self esteem issues, self esteem is a psychological phenomenon, not a physical one. Self esteem issues are typically created from a mixture of the internal problem having a negative outlook on life and the external problem of society being judgemental.
And of course if the answer to "why do I want her to go to the gym?" is "because she's fat" then you really need to reevaluate why you're in this relationship. Getting into a relationship and then trying to change your partner isn't healthy. The point of a relationship is to be with someone you like, not to find someone and then try to turn them into what you want them to be.