Retroactive continuity, or retcon for short, is a literary device in which established diegetic 'facts' in the plot of a fictional work are adjusted, ignored, or contradicted by a subsequently published work which breaks continuity with the former.
There are various motivations for applying retroactive continuity, including:
To accommodate desired aspects of sequels or derivative works which would otherwise be ruled out.
In response to negative fan reception of previous stories.
To correct and overcome errors or problems identified in the prior work since its publication.
To change how the prior work should be interpreted.
To match reality, when assumptions or projections of the future are later proven wrong