The time and place of a work of literature is called the setting. The setting of the Sherlock Holmes novels, for instance, is 1900s London, England. Jane Austen’s “Pride and Prejudice” is set in 1800s England, in both the countryside and in London. Many authors use either a setting near them - both Sir Arthur Conan Doyle and Jane Austen used England and the places they grew up as inspiration - or make one up, like Wonderland in Lewis Carroll’s “Alice in Wonderland” or Narnia in C.S. Lewis’s “Chronicles of Narnia” series.
The setting is often a crucial part to the novel or a movie. What’s around the characters will influence what they do, and often that’s the difference between a novel making sense or a novel not making sense.