Fiction is made up, and nonfiction deals with facts and real events. For example, the novel Alice in Wonderland is fiction because it is Lewis Carroll’s imaginative creation, while the book A History of Modern Europe is nonfiction because it is about real things and its author strives for factual accuracy.
The distinction is sometimes blurry. For instance, what do we call a novel based on real events with a few imagined details mixed in? What about poetry that embellishes biographical events with imaginative flights? What about an educational documentary with dramatic representations of historical events? These types of texts don’t fall into a single category, and the debate about how to classify them is ongoing (and will probably continue indefinitely).
In general, however, making the distinction is easy. Most novels, short stories, plays, narrative films, ballets, and operas are fiction, and most essays, textbooks, memoirs, scientific papers, documentaries, and histories are nonfiction.
Nonfiction is a single word—no hyphen needed.