Thanks for your reply, Ic3Rabbit. The doctor suggested riding on a stationary bike right after the sprain happened. So a few days after the sprain, I rode on the bike but then my foot swelled up even more and became very bruised. So between that and the fact that getting to the gym is difficult, I've been hesitant to go back. But now that it's been 3 weeks and the swelling is way down, I think I need to try again but I might start with the swimming first, as you suggested. The swimming should be less strenuous.
Thanks for your reply as well, Cl2. Hiring a physical therapist is a good idea but I'm a little hesitant to spend the money on that right now. If my ankle is not much better in a couple of weeks, then I might try that.
You say your entire foot is swollen, not just the ankle area? That sounds like it could be more than a sprained ankle.
My story: I rolled my ankle, causing a sprain and a fractured 5th metatarsal (colloquially, a dancer's fracture). Needless to say, my entire foot was swollen and bruised. I suspected a fracture (um, heard a crack) so I specifically asked the doctor for an x-ray.
If your foot isn't better in a few weeks, go to a specialist, orthopedist or sports doctor. Get the specialist to refer you to a PT. If your foot is still in an acute state of injury after a few weeks, there's obviously something wrong, and going to the PT before an orthopedist is like putting the cart before the horse.