At their core, styes are bacterial infections that often take root in the base of an eyelash, or the follicle. It doesn’t take much for this part of the body to become infected: simply touching a surface containing bacteria and then rubbing your hands and fingers over the eye can result in a stye emerging.
A chalazion is less likely to be caused by a bacterial infection; instead, this much larger (though often less painful) lump in the eyelid is caused by the blockage of oil glands. If the glands that produce oil a top or underneath the eyelid become blocked, a chalazion can result. Although the sizes of styes and chalazions vary, both look similar to a pimple.