Remember that Magwitch was a convict. At the beginning of the book, he is one of the convicts out hiding in the marshes. He was recaptured and transported (sent to Australia as punishment). He was told that if he ever came back to England he would be executed.
So, over the years, he's become rich and he has decided to come back to England. Since he can't afford to be recognized, he sort of has to hide out. He comes specifically to London because of Pip. He wants to see Pip being a gentleman since he, Magwitch, is the one who has helped Pip become a gentleman.