In the opening chapter, purely by chance Pip meets Magwitch a criminal who has escaped from the "hulks." In Ch5. we learn that 'the hulk' is a prison ship where prisoners are temporarily lodged before they are exiled for life to Australia. Pip gives Magwitch a file with which Magwitch cuts the shackles and frees himself; Pip also gives him some food which helps Magwitch to sustain himself on the marshes. Later, Magwitch is captured and exiled to Australia. There he works hard and lives frugally to become a rich man. In order to repay Pip's kindness, Magwitch through Jaggers arranges secretly for Pip to be educated in London to become a gentleman. Magwitch had instructed Jaggers that he must not reveal to Pip that it was he who is paying for his stay and education at London.
Meanwhile, in England Pip had become infatuated with a very pretty but very proud girl called Estella who is being brought up by a very eccentric rich old lady Miss Havisham. Pip frequently visits Miss Havisham to keep her amused. During each of these visits Estella humiliates Pip, but this only increases his love for her. In Ch.17 he confesses to Biddy his childhood companion, "I want to be a gentleman on her account." In the very next chapter Pip's 'great expectations' are announced and he mistakenly believes that it was Miss Havisham who has arranged for his stay and education at London as a means of compensating him for the services he had rendered to her.
In Ch.39, Magwitch risking his life returns to England. He meets Pip and tells him that it was he and not Miss Havisham who was responsible for transforming him into a "gentleman, "yes, Pip, dear boy I've made a gentleman on you!" Initially, Pip is overcome with shame and disappointment but soon he overcomes his revulsion for Magwitch and helps him to escape back to Australia. However, Magwitch is wounded when trying to do so and is arrested and dies in prison. When in prison, Pip visits him frequently and is at his bedside when he breathes his last.