I was thinking about this while musing, as one does, about the original Star Wars trilogy. But my question isn't specifically about the history of that canon, but the broader concept of something being "canon" in popular culture.
When did this start? Was it something that started specifically with Star Wars, or Star Trek? Or does it have an older history in, say, Golden Age science fiction or pulp fiction (like were there ever debates as to whether Cthulu Mythos stories not written by Lovecraft were "canon")? Is it more-or-less a science fiction phenomenon? I feel like it is because I'm not familiar with discussions of, say, Jean Rhys' Wide Sargasso Sea being "canon" with Charlotte Bronte's Jane Eyre, but are there non sci-fi cultural examples?
The use of "canon" in this context comes from the application of higher criticism to the Christian Bible (and related religious works), and was first applied to popular literature by Rev. Robert Knox in "Studies in the Literature of Sherlock Holmes" (1911). The use was subsequently taken up by later fandoms, although the process took a while. When H. P. Lovecraft and his contemporaries were piecing together the shared universe that became known as the Cthulhu Mythos, for example, Lovecraft made some aborted efforts to keep certain matters consistent between authors, and after his death considerable work by August Derleth, Francis T. Laney, and others went into trying to catalogue, codify, and classify different aspects of the Mythos - characters, entities, books, places, that kind of thing.
Part of the reason that the idea of a "Canon" came up is because Sherlock Holmes generated so much uncanonical secondary material, including pastiches, parodies, chronologies, supposition, etc. derived from Sir Arthur Conan Doyle's original work, and a need was felt to distinguish between the primary texts and the secondary additions.
It is difficult to argue if the idea existed earlier than this, although certainly higher criticism and textual criticism didn't arise out of nothing. There was very much an idea of later works which built upon but were separate from earlier works, like Homer's Iliad, Virgil's Aeneid, and Dante Aligheri's Inferno, but if there was an early application of the idea of "canonicity" to tales which referenced or were in some way dependent upon earlier works, I'm not aware of it.