The Hobbit is one of the foundational works of the subgenre known as high fantasy or epic fantasy. The broader umbrella of fantasy includes works set in imaginary worlds (based on the real world or not) in which magic is real. Plenty of fantasy literature came before Tolkien's novel and the Lord of the Rings trilogy that followed it. What Tolkien did that stood out was to write an epic set in an imaginary, magical world.
Earlier examples of epics include The Odyssey and Beowulf, both of which influenced Tolkien. In these stories, the protagonist goes through an episodic series of dangerous adventures that teach them how to be a hero. The stakes of the journey are high, involving divine intervention, close calls with death, and threats to entire political regimes. These epics are not devoid of what readers today think of as magic, but this magic mainly comes from the gods in whom their original audiences believed. It is thus more "real" than fantasy magic.
Bilbo lives in a world of undisputed fantasy. Still, he goes through just the sort of episodic journey that Odysseus and Beowulf endure. His encounters with wizards, dwarves, trolls, goblins, eagles, elves, a man-bear, a dragon, and more all culminate in the Battle of Five Armies, a legendary fight of historic proportions. Bilbo's adventure teaches him, like the hero of any good epic, how to be heroic without losing track of his humble roots. High or epic fantasy became a popular subgenre all its own following Tolkien and some of his contemporaries' success. It even led to the creation of popular role-playing games like Dungeons and Dragons, games that revolve around the idea of heroic character development in a magical world.
Even though Bilbo is a recognizable hero, he is a somewhat down-to-earth, bumbling figure compared with larger-than-life heroes like Odysseus and Beowulf. Partly, this is because The Hobbit was originally meant for children. Like Lewis Carroll's Alice's Adventures in Wonderland, it features a character with whom young readers can identify. However, Tolkien's decision to center the novel on such an ordinary protagonist can be traced to several other genres that influenced his writing. For one thing, Tolkien was a medievalist. He drew many of his ideas from medieval and early modern literature, including religious allegories centered on figures like the "everyman" who was nondescript enough to represent all of humanity. Bilbo is a kind of "everyman" who proves that anyone can become a hero.
The Hobbit also draws on the genre of the historical romance, a kind of dramatized historical fiction popularized especially by Walter Scott's 19th-century Waverley novels. Like Waverley and the other books in this series, The Hobbit has a narrator who claims to be recording historical events as documented in archival materials—materials that the author of the novel has invented. Historical romance typically tells the story of a major (and real) historical event from the perspective of a semi-anonymous, fictional person who happened to get swept up in it. The genre thus emphasizes the idea that anyone can find themselves embroiled in history. The Hobbit's major historical event is the Battle of Five Armies, a battle that of course is as fictional as the world Tolkien creates. However, within the fantasy world, Bilbo is drawn into the battle just like one of Walter Scott's protagonists. He is an epic hero, but he is also ordinary enough for everyday readers to relate to.