The brief description from Masterclass describes fantasy as a genre of fiction that uses magic or supernatural elements in the real world. While some writers chose to use the real world as the setting with fantasy elements, Many create their own universe such as Game Of Thrones to name a popular one.
Citation: Brown , D. (2021, October 1). What is the fantasy genre? history of fantasy and subgenres and types of fantasy in literature - 2023. MasterClass. https://www.masterclass.com/articles/what-is-the-fantasy-genre-history-of-fantasy-and-subgenres-and-types-of-fantasy-in-literature#1ohlGtc2LQELZODJ70qLGU
If you are interested in the fantasy genre, Where it came from and how it became so popular in today's day in age, I would recommend starting to read books from mythology. It is no secret how stories were shared in the past, by tales of mythology. Whether that was Greek or Norse, the love for these stores crafted what we call fantasy today. During the 1800s the Grimm Brothers were first brought to the scene and changed the game. They invented characters such as Cinderella and the little mermaid. Bringing in the magic element to a real world setting. Most of the fantasy novels today are influenced by European folklore and its histories. Think about how many castles and kingdoms are mentioned when reading fantasy books. It is not a Coincidence that the long-lasting popularity of the genre will forever be associated with European influence.
Citation: Pagan, A. (2020, May 18). Hallmarks of fantasy: A brief history of the genre. The New York Public Library. https://www.nypl.org/blog/2020/05/18/hallmarks-fantasy-brief-history-fantasy