Kafka may have been inspired by actual hunger artists, who were quite popular during his lifetime. The hunger artist in Kafka's story combines two freak show acts: the "skeletal man," who was visibly emaciated like the guy in this story, and the hunger artist, who was actually rather obese (source: Miezkowski, Jan. "Kafka Live!" <em>MLN </em>116.5 (December 2001). 979-1000).
Max Brod, Kafka's close friend and literary executor, described Kafka in his last days as having a larynx so swollen that he was unable to eat anything (source: Miezkowski, Jan. "Kafka Live!" <em>MLN </em>116.5 (December 2001). 979-1000).
In a letter, Kafka described his ideal writing environment in a way that's a lot like "A Hunger Artist": "I have often thought that the best mode of life for me would be to sit in the innermost room of a spacious locked cellar with my writing things and a lamp. Food would be brought and always put down far away from my room, outside the cellar's outermost door. The walk to my food, in my dressing gown, through the vaulted cellars, would be my only exercise" (quoted in Thier, Allan. <em>Franz Kafka: A Study of the Short Fiction. </em>Boston: Twayne, 1990).