This is a very interesting question. The starting point for an answer is the difference between fiction and real life. A Hunger Artist by Franz Kafka is not a piece of journalism, but instead a work of imagination. Many literary works -- or movies or video games -- describe characters doing things that people would not (or could not) do in real life. That is part of what makes literature valuable, in that it allows us to explore things with our imagination that might not be smart or feasible choices in reality.
Extreme fasting is actually used as a form of protest in many cultures. The early suffragettes used hunger strikes as a form of protest when trying to fight for women's right to vote, and for Mahatma Gandhi hunger strikes were an important tactic of non-violent resistance in the fight for Indian independence for Britain. Some protesters in developed countries may fast or live in temporary shanty towns to call attention to the many people in our world who starve not by choice but due to war or poverty. Extreme fasting is also part of many religious traditions, sometimes as part of a ritual calendar (e.g. Lent); among the religions that practice ritual fasting are Christianity (especially the monks and nuns in the middle ages) and various forms of Buddhism or Hinduism.
Self-starvation also is sometimes part of performance art, most recently in the case of David Blaine, though this has received somewhat mixed reviews.
In the case of A Hunger Artist by Franz Kafka, the focus seems more allegorical, with physical starvation symbolizing lack of spiritual sustenance. Although it might be possible to consider the protagonist's final confession of his inability to eat as a psychological disorder, perhaps a form of anorexia, Kafka's intent was more probably to make the protagonist an emblem of the artist's alienation from society and perhaps humanity's separation from the divine in a postlapsarian world.