Most laptops use Lithium-Ion type battery packs. While hugely efficient, they do have the issue that if charged incorrectly, or allowed to discharge too completely, they will swell (or occasionally worse, explode). It also can simply happen due to the battery becoming old.
The swelling is in fact due to the release of gasses by the electrolytes used in the cells. As they are sealed, the gas has nowhere to go, and therefore the swelling.
This line of MacBooks happens to have the unfortunate design flaw that the battery resides below the switch used by the trackpad - so if/when the battery swells, the button is clicked from below, and sometimes even left permanently clicked (which is why you would see your mouse completely stop working for clicking).
Luckily the solution is fairly simple, and I you're willing to go with a non-Apple product, inexpensive. I replaced my pack with one from eBay (a third-party China made pack) for under $30, and it has worked perfectly ever since! Plus, you get the added bonus of getting your battery life back, so it really is a no-brainer!