This where a small cyst develops in the eyelid. It is most commonly due to a blocked oil gland and is non-infectious. It is also known as a meibomian cyst.
It can spontaneously discharge or sometimes gentle warm compresses can help. They usually resolve within a few weeks but occasionally persist for months. Sometimes they do need incision and drainage but the preference is to leave them to self resolve.
It is rare that they become infected and require antibiotics.
How is it different from a stye?
They do look similar to a stye (or hordeolum). A stye grows from the base of an eyelash and is usually due to an infection at the hair follicle. It is usually very painful, whereas a chalazion is not. A chalazion is usually further back on the eyelid whereas a stye is right on the edge of the eyelid.