Within a movie or TV show, you typically have continuity. For example, if at the beginning of a movie it is established that a character grew up as an orphan, at the end of the movie they won’t be talking about how they were raised by their parents.
“Canon” takes this idea of continuity but extends it to multiple forms of media so that they all have one coherent, interrelated storyline. Something that happens to a character in a comic book is just as “real” to the character as if it happened to them one episode ago in a serialized TV show, if the comic and show exist within the same canon.
“Headcanon” is a tongue-in-cheek name for a fan theory that explains away a plot hole, break in continuity, or something important that has gone unexplained, often by drawing on the wealth of lore present in the canon.
Latest Answers