What is the relationship between realism and fantasy in this story? What are some details that make the fantastic story credible?
As mentioned above, waking up one morning to find you have transformed into a cockroach definitely falls into the fantasy category. However, the story's power lies in how realistically the details of both being a cockroach and an average human are rendered. As a cockroach, Gregor cannot keep his bed covers on easily because he has six legs waving in the air, and he has trouble getting out of bed and maneuvering due to his new, ungainly body. Also, his life situation as a man trapped in an unsatisfying job is realistic, along with his family's worries (and his own) about his being unable to work. This is coupled with the growing resentment of his sister, who has to take care of him. Kafka's stroke of genius is taking what most writers would use as a metaphor—feeling reduced to an insect by your job and your life—and makes that aspect a literal, if fantastic, fact in the story.
The fantasy part is easy - transforming into a giant bug definitely fits the definition of fantasy (not able to take place within the realm of reality). However, Kafka then does an amazing job at very realistic showing the conflicts that come from this transformation. He slowly loses the love and support of his family. He suffers from loneliness, hungry, rejection, etc, until finally any human part of him seems completely lost. Through these very realistic reactions and very human complications, the fantasy story becomes, in some respect, believable.