What causes granulomas? Granulomas form when immune cells clump together and create tiny nodules at the site of the infection or inflammation. A granuloma is the body's way of: containing a bacterial, viral or fungal infection, to keep it from spreading (also called a caseating granuloma);