Cunningham appears earlier in Joyce's work, in the short story "Grace" from Dubliners. According to Gifford's annotations, Cunningham himself was modeled on a man named Matthew F. Kane, the chief clerk of the Crown Solicitors' Office.
Throughout the day, men gossip about Bloom and talk about him behind his back. Cunningham tends to be the least disparaging of Bloom, the one most likely to stick up for him. In "Hades," he tries to tone down the men's anti-Semitic talk, and later scolds Jack Power for speaking of suicide before Bloom, whose father, Rudolph Virag, killed himself. In "Cyclops," when Cunningham comes for his meeting with Bloom, he finds the men have all gathered against him. The citizen is particularly cruel and vehement in his mocking of Bloom, and Cunningham does his best to calm them down. When Bloom arrives, Cunningham rushes him out to avoid a scene. For all these reasons, it makes sense that Bloom imagines Cunningham as the foreman of the jury in his masochistic court fantasy.
Cunningham's other minor role in the story is that he is taking up a collection for the widow Mrs. Dignam, and is trying to get Dignam's son into Jesuit school for free. Here, as elsewhere, he comes across as a kind and goodhearted man.