pH differences are a big thing fish don't tolerate well. Eventually they can get used to a pH, but that's after being acclimated. So if the pH was vastly different, probably shocked. The swelling...like around the gills? There may have been something wrong with the water, I'm sorry I'm nto much more help...
But testing the pH of your water, testing for ammonia and nitrites and nitrates, temperature....all important things to know, as well as to figure out what exactly would affect your fish. (I've recently learned lots on this site) So Master Water Testing Kit would do wonders, which I think includes everything you need to know bout your water.