You know... I'm looking at all the 'but canon tho' arguments in here and thinking, really, who gives a damn about canon anyway?
Fanfic is an inherently transformative enterprise. The underlying premise of fanfiction is to take some existing work, and change it. You cannot write fanfiction without disregarding canon, and you should not be concerned about doing so.
The notion that being 'canon compliant' is necessary and good for fanfic is absurd, and the notion of 'canon purism' should go die in a ditch. We'd all be better off without people breathing down our necks about the 'correct' way to write Character X.
The thing about canon and its relationship with fanfiction is that you can never fully divorce the former from the latter. As others in this thread have noted, one of the main draws of writing fanfiction is the fact that the author is able to use a pre-existing framework to explore their ideas. It isn't necessary to develop characters from the ground up, spend considerable time establishing basic world-building, or establish other background elements. There is an unspoken assumption that the reader is already familiar with these aspects of the setting due to some familiarity with the original work, so an author is able to immediately focus on the execution of their ideas, whereas in original fiction this groundwork would need to be laid first.
That being said, there's nothing stopping an author from altering said elements or even completely scrapping them and and starting anew. It's been done numerous times before and sometimes to great success. However, when an author seeks to make changes to the original work the aforementioned pre-existing framework of fanfiction becomes somewhat of a double-edged sword.
Readers familiar with the source material, which are likely to be the majority due to the nature of how people search for fanfiction, are coming into the story with pre-conceived notions of the setting and characters. This isn't a fault on the reader's part, as by deciding to write fanfiction an author has implicitly accepted the fact that their work cannot be seen completely independently from the original work, often times actually relying on this fact. As such, the reader is naturally going to assume that elements from the original work are the same within the fanfiction unless it is established otherwise.
It falls on the author to communicate to the reader what elements are being retained through the text or summary. Specifics aren't necessary from the get-go, but an AU tag or an initial focus on altered/new content can give the audience an important impression of how similar they should expect the story to be to the original.
This isn't just a matter of audience perspective though. As an author is working within a pre-existing framework, any new elements they introduce have to coexist with the rest of the setting. An addition must either be compatible with the framework, or adjustments must be made to the framework in order to make it compatible. This isn't much of an issue with small changes, but the larger or more numerous the changes the more work must be done in order to keep the story cohesive. In that sense, fanfiction that restarts from the ground up has an advantage, as an author who is throwing out most of the framework doesn't have as much to worry about when reconciling new additions with the remaining "canon" elements.
The trouble really lies with fanfiction that tries to retain the majority or at least significant portions of the framework while also introducing impactful additions or alterations. An experienced author will probably be able to find a way to maintain a cohesive story, as a last resort accepting that the old and the new cannot exist together as is and choosing to either cut away more of the framework or lessening the scope of the addition/alteration. On the other hand, authors with less experience may not immediately recognize the compatibility issue or just struggle to resolve it. In the worst case scenario, the author is aware of the contradictory elements in their story but chooses to ignore them, leaving their work more flawed overall than it would if they had sought to resolve the issue.
To give an example of the kind of incompatibility I'm talking about, the kind of fics that most often suffer from this flaw would be those that introduce massive divergences yet still remain firmly welded to the stations of canon. If you're familiar with Naruto, this would include those stories where Naruto is given some massively op ability from the start of the series that puts him leagues above where he was in canon, yet events still progress exactly the same with superficial changes at most. A less power-focused example would be those where Minato never dies, but the overall plot progresses the same as canon despite events being heavily dependent on a situation that resulted from his death.
A more character-focused example would be when a fic keeps a character's backstory exactly the same as in canon, but gives them a vastly different personality despite the lack of any sort of divergence that would explain or result from the difference. Like, the character did and experienced the exact same things as the version from the original work right up until they appear in the story, yet for no explicable reason once they appear "on-screen" their character completely changes. The fact that the character is different from canon isn't an issue, but the fact that this difference isn't reflected in their role in the story is.
At their core these issues are rather basic flaws that can occur in all fiction. Character actions not lining up with their established personalities, multiple story elements contradicting one another, poor world-building, etc. With original fiction an author has to make sure that these issues don't appear in what they're creating. However, if an author is relying on the characterization or world-building of another story, they have to make sure that what they're creating doesn't have these issues with what they're borrowing. Again though, the less an author borrows the less they have to conform. It isn't as much of a matter of respecting the original work as it as matter of maintaining internal consistency.
To sum things up, canon can never be completely divorced from fanfiction, as a story that borrows from another can never be entirely independent from the source material. However, the relevance of canon varies and is dependent on just how much of the original the inspired work retains. The only time complaints about writing character X "correctly" can be legitimate is when the author is meaning to write using the characterization established in canon. (Not to say that many of these sort of complaints aren't nitpicky bullshit. They often are, and that's speaking as someone who has realized that he's been that guy in hindsight.)