I have a swelling around my index fingernail and it pains if pressed. What can be done?

Finger pain. Could be an infection of the skin. If the pain is throbbing more likely it is an infection. If you see progression, redness extends, pain getting worse, go see a doctor asap.The earlier the intervention the better it is.
Infected- If its on the sides of the nail, then you likely have a paronychia. If it's swollen and getting more painful, i would get to a healthcare provider so that they can determine if a warm soak, antibiotics, or a a simple incision and drainage is required. Other possibilities include a foreign body insertion (e.g. Splinter), an ingrown hair or hangnail that is now infected.