As a bildungsroman Great Expectations by Charles Dickens tells of Pip's different stages in life. In the Second Stage of the novel, Pip becomes very haughty as he believes himself a gentleman and above associating with Joe and Biddy. When Magwitch arrives in London as Provis, Pip is repulsed by the crude way that he eats and acts, although he does shelter the old convict. When the old convict relates the history of his life in his poverty and exploitation by Compeyson, Provis looks at Pip with affection, an act that is yet abhorrent to Pip, but he admits, "I had felt great pity for him."
With the realization of the life to which Magwitch has been forced into, Pip begins to perceive that the man is undeserving of condemnation. That he so loved Pip that he gave his money and risked his life to see the boy made a gentleman, touches Pip. And, in his maturation, Pip recognizes that he has misjudged Magwitch. So, as the convict stays with Pip, Pip begins to worry that Compeyson may discover the return to London that Magwitch has made and either report him to the authorities or kill him. Therefore, out of respect for what Magwitch has done for him, Pip tries to effect an escape for Magwitch. And, when this escape fails, Pip lovingly tends the man who had but few moments of happiness in his life. He tells Magwitch--"Dear Magwitch, I must tell you, now, at last--of Estella and comforts the old convict, who dies shortly thereafter:
I thought of the two men who went into the Temple to pray, and I knew there wer no better words that I could say beside his bed than, o Lord, be merciful to him, a sinner!
Because of the generosity and love of Magwitch, Pip truly learns how to be a gentleman.
In my opinion, it has to be the fact that Magwitch is about to die that makes Pip change his mind about his benefactor.
When a person is about to die, your thinking about your relationship with them surely changes. Anything you have against them surely has to get put aside unless it is really a big deal. You no longer have any time -- you can't make up with one another later.
So now that Magwitch is so badly hurt, Pip has to rethink. When he does, he realizes he's been really bad to Magwitch. This leads him to change his opinion.