Modern fantasy and science fiction are now considered more-or-less the same genre. Although they are shelved together in bookstores, they are quite different in origin and orientation.
Fantasy, as I discussed earlier, is the world's oldest literature, larger-than-life people racing across the landscape, having adventures that include a major element of marvel and the supernatural, adventures that the authors use to make moral points and to critique their society. Think of Gilgamesh (a Babylonian epic) or, for that matter, the Old Testament. Modern fantasy is a re-imagining of the twelfth-century epics and romances--but in the twelfth century these stories were not considered "fantasy" but simply literature.
Fantasy became a major genre in the twentieth century. But when J. R. R. Tolkien's Lord of the Rings essentially started it in the 1950s, no one knew what to call it. (There were some earlier examples, but not enough for a genre.) The terms "fairy tales for grownups" and "super science fiction" were used in reviews of Lord of the Rings. Fairly quickly people settled on "fantasy" (a term popularized by Ballantine Books in the 1970s), although the word "fantasy" still is used widely to use something completely imaginary, or something like a guy being surrounded by a bevy of lovely and willing wenches.
Today "fantasy" novels are expected to have dragons, wizards, and a more-or-less medieval setting. This is true of my own novels, Tolkien's, George Martin's, and thousands more. Some authors start with real medieval history and add magic, which can be considered historical fantasy. Some authors try to defy the stereotype, putting magic (and sometimes elves or vampires) into the modern world, which can be either considered urban fantasy or magic realism (depending on the number of elves and vampires). You know it's a popular genre when it spawns a lot of sub-genres.
Science fiction has much more recent roots, yet was established as a genre in popular literature before fantasy. It began as a genre in the early twentieth century in the wake of the industrial revolution, as people began speculating on where our technology could take us--and whether that would be good. While fantasy is set in an imaginary past, science fiction is set in an imaginary future. Most commonly it has spaceships.
Although there has always been an element of "Aiyee! Here comes the tentacled space monster!" in science fiction, true fans prefer what they call "hard" science fiction, which is based on real science and which tries to have a rational explanation if something seems to defy what we would consider the laws of the universe. Along with the adventures, there will be a lot of "world-building," speculating on what life on other planets or for alien species would be like, and how humans would react.
In spite of being set in an imaginary past or imaginary future, both fantasy and science fiction are really commentaries on our our society--as fantasy has been since the beginning. This is clearly evident in science fiction. When modern American society is booming, novels show an optimistic future, with poverty and crime overcome and lots of flying cars and pet robots. When the American economy stagnates, novels give us dystopian futures, full of evil repressive overlords. You can learn a lot about the 1950s and 1960s by reading the science fiction written then.
© C. Dale Brittain 2015