Cysts form due to a variety of reasons. They can be caused by:
Infections
Injury
Chronic inflammation
Blockage in ducts, follicles, glands, or pores
Inherited diseases or conditions