Gaining large amounts of weight from exercise?

Options
This has happened to me twice already, but not recently, I'm just curious.

A couple years back, I tried the Atkins diet and joined a gym. I was losing weight rapidly and lost about 35 lbs. Then I got tired of the diet and started eating regularly. I also stopped exercising. I gained about 20 lbs initially, and when I began working out again, I gained 8 more lbs in a 3 day span. It didn't go away until I started using myfitnesspal. Earlier this year, I tried a weight training program. After a couple of weeks, I gained 10 lbs in just 2 days, and I'm still trying to get rid of it.

Through both of these times, I didn't get visibly larger, just heavier. What gives?