When it happens
Mild dementia, growing worse until around mid-moderate stage dementia, when advanced memory impairment causes the person's awareness of cognitive trouble to disappear
Why it happens
This personality change is a function of the person's struggles with cognitive changes. Aware of problems with memory and other thinking skills, the person with dementia has to work hard to compensate. This means greater focus on keeping track of things, performing well, and possibly hiding deficits from loved ones. All that concentration takes energy -- causing the person to unintentionally become more focused on himself or herself, to the exclusion of others.
Eventually people with Alzheimer's lose the awareness of having a problem. When this happens, they often seem to be more engaged again.
What you can do
Simply being aware of the cause is a huge help; don't take it personally.
Be empathetic to the person's struggles and try to help him or her remember and do things as best you can.