While Pip initially believes it's the mysterious "Esquire" he meets in the marshes, it's ultimately revealed that Miss Havisham is the one who arranges for his fortune and upbringing. She does this as a way to manipulate and avenge herself against the world that wronged her.