If the battery is swollen, that can cause pressure on different components inside the rest of the laptop, as well as being a safety hazard that could explode and dump hot battery acid in your lap at literally any moment.
First order of business is to get rid of the battery, and see if that resolves the issue. If not, it's possible that the battery caused flexing of the MLB, and on a unit that old, it wouldn't surprise me in the least if it caused a few solder joints to go intermittently cold right around the top case connection port, which isn't far from the battery compartment.
The other problem with Bob's advice on these style MacBooks, is that getting the top case off is a major PITA. If you do attempt it, just remember to pay VERY close attention to where the screws came from, because they are all different sizes. There are also two screws on the side of the unit by the battery, which do not need to be removed. The only thing they do is hold on this annoying little metal piece that the front left corner of the top case will invariably get caught on and elicit some choice four letter words as you try and extract it without bending things up too much. PC makers tend to use all one type and size of screw, whereas Apple loves to mix it up. Put screws back in the wrong location on these models, you may never get them back out again short of physically breaking the top case.
But before you do all that, if you have any splintering of the top case, like along the front edges where the hell of your palms would rest, then you should be able to get Apple to replace the top case for free. I'd suggest throwing a little business at a local AASP though, since they get shafted by Apple coming and going. In this particular case, they can give a bit of a shafting back to Apple, and you're helping support a small local business which is always good. The money stays in the local community instead of going to some tax dodge shell company large corporations have set up all over the world. Apple's is in Nevada BTW, and I have a strong suspicion that's also why they have a Houston, TX office. Two states known for their low corporate tax rates.
In any case, start by removing the battery, see if that helps improve things at all. If not, then check the ifixit site to learn how to get the top case off, disconnect the top case, short the power pads on the MLB with an external keyboard and mouse connected and see if the problems persist. If yes, you may as well buy a new laptop because it's a minimum of $300 to get that one fixed if it hasn't hit vintage status at which point the cost just pretty much doubled and only if you're in California. Either way, that thing probably isn't even worth $300 anymore, so may as well put that money towards a new computer. If the problems go away, then you just need a new top case which is about $80US for the part, and then whatever labor charges might be. That one would seem borderline worthwhile given the age of the unit.