By the sound of it, he probably was sick. Unfortunately many bettas kept in un-ideal conditions might suffer, and it sucks!
Cycling is good for 5 gallons and up, and can take 4-6 weeks approximately with an ammonia source...a fish... pure ammonia...piece of raw shrimp... or fish food. With 50% weekly cleaning.
Personally I say stay away from Walmart bettas. I dunno where you got your fella... Depending on your area you might have a breeder near you, or someone on here who could ship you a healthy betta, especially if they are close enough! Aquabid might have some too, if you would be willing to have one shipped
I've seen Ebay ones go for free shipping, and decently priced bettas.
If you cannot get one shipped, try a live fish store over a pet store. They tend to care more! If you have to go with a pet store, just check these:
1. bettas fins are full and not stuck together. 2. the betta is active and reacts well to you or other fish, va flaring or becoming active. 3. Color is full, without discoloration, patches, ich, or rot/holes in fins or body. 4. the gills shouldn't be stuck open, inflamed, but because they are in cups they may not be a healthy pink either, as they should be.