This happens when the nail grows downward into the skin instead of straight out, usually causing an infection. Ingrown toenails are most common on the sides of the big toe. It can also be caused by shoe pressure, injury, fungal infections, poor foot structure, etc.
Warm water soaks several times a day, properly fitted shoes and socks, and trimming nails in a straight line (rather than rounded) are ways to treat and prevent painful ingrown toenails. If there is an infection, antibiotics may be prescribed.
If left untreated, the skin may begin to grow over the toenail, encapsulating the nail. Surgery is then required to remove the nail.