From Scientific American:
Although scientists have not pinpointed exactly what goes on in the brain when a person experiences déjà vu, they can make good guesses based on models of memory. All theories of memory acknowledge that remembering requires two cooperating processes: familiarity and recollection. Familiarity occurs quickly, before the brain can recall the source of the feeling. Conscious recollection depends on the hippocampus and prefrontal cortex, whereas familiarity depends on regions of the medial temporal cortex.
When these cooperating processes get out of sync, we can experience déjà vu, the intense and often disconcerting feeling that a situation is familiar even though it has never happened before. This feeling can occur when a brand-new situation is very similar to other events stored in our memory. For example, a Texas airport may seem vaguely familiar to you even though you have never been to Texas. It is possible the airport is strikingly similar to a single event stored in memory—perhaps you recently saw the airport in a movie or magazine. It is also possible that many memories of visiting similar airports create the sensation that you have been to this one. Déjà vu is a stronger version of this kind of memory error.