Epithelioid cells are formed through the transformation of monocytes into macrophages and subsequently into epithelioid cells. This process is typically triggered by chronic inflammation. The transformation is driven by various cytokines such as interferon-gamma (IFN-γ) and tumor necrosis factor-alpha (TNF-α), which promote the differentiation of macrophages into these specialized cells.