A localized ankle swelling can be cyst, a hematoma, localized collection of fluid, a varicose vein causing venous pooling, an ulcer due to friction from foot wear, arthritis or due to infection (boil). It can also be a lipoma or a neurofibromas (collection of nerves and fibrous tissue). Since it is painful it can be an infected cyst, a boil, a neurofibroma or an ulcer due to friction. You can take an anti-inflammatory pain killer and apply an antibiotic ointment. However, you need to consult a doctor. Take care!
The medical advice given should not be considered a substitute for medical care provided by a doctor who can examine you. The advice may not be completely correct for you as the doctor cannot examine you and does not know your complete medical history. Hence this reply to your post should only be considered as a guiding line and you must consult your doctor at the earliest for your medical problem.