Sprains in any joint of the body happen when a ligament is stretched or torn. For ankles, this typically occurs during sports activities or a misstep while walking/running on uneven surfaces.
The best way to manage the pain that you feel as a result of swelling in the ankle joint is to follow the R.I.C.E. (rest, ice, compression, elevate) method. This is simple and most likely involves items you have around your house.