A chalazion occurs when one of the oil glands that line the edge of the eyelid becomes blocked with oil and forms a bump in the eyelid. It is unknown why some patients get chalazia and others do not, but patients who have chronic inflammation of the oil gland openings can be predisposed to forming them. A chalazion is not exactly the same as a stye, though those two terms are usually used interchangeably. A stye is a bump in the eyelid that occurs when an oil gland becomes infected. Most chalazia resolve on their own within several days to weeks, but some can linger for months. Warm compresses over the affected area in addition to massaging the lid margin with baby shampoo can speed up resolution of chalazia. Surgical drainage can be considered for large, persistent chalazia.
Source: American Academy of Pediatric Ophthalmology and Strabismus