Canon, in the context of a fictional universe, comprises those novels, stories, films, etc., that are considered to be genuine or officially sanctioned, and those events, characters, settings, etc., that are considered to have existence within the fictional universe. In order for a setting to appear cohesive, especially in fictions that contain multiple parts, both creators and audiences sometimes find it useful to define what has and has not "actually happened" in that universe.
Material that is considered canon usually comes from the original source or author of the fictional universe, while (some) spin-offs and adaptations to other media are more likely to be non-canon and fan fiction is almost always non-canon.