In which chapter of 1984 does the quote about controlling the past appear?
George Orwell's dystopian novel, 1984, is in many ways intended to satirize the Soviet Union, and especially the way that, during the Stalinist regime in power during 1949 when 1984 was published, Soviet revisionist historians rewrote history to support their version of Marxist-Leninist ideology, expunging from history books anything not flattering to their regime or belief system.
In the same way, the Ministry of Truth, at which Winston Smith works, is tasked with constantly revising or destroying all records of the past which might discredit the Party or Big Brother. For example, Oceania is alternately allied with Eastasia and Eurasia. Whenever the alliances change, all books and newspapers are edited to make it appear that the current ally was always, in fact, an ally, and to eliminate any evidence of shifts in allegiance.
Winston first explains how and why this system works in Part I Chapter 3, saying:
...if all records told the same tale--then the lie passed into history and became truth. 'Who controls the past,' ran the Party slogan, 'controls the future: who controls the present controls the past.' ... 'Reality control', they called it: in Newspeak, 'doublethink'.
It is repeated in Part 3 Chapter 2 by O'Brien, after Winston has been captured and during the process in which he is being tortured and brainwashed into complete submission to the Party.
It is in Part One, Chapter Three of 1984 that you can find the following quote about controlling the past:
"Who controls the past," ran the Party slogan, "controls the future: who controls the present controls the past."
To illustrate the meaning of this quote, Winston uses the example that Oceania is at war with Eurasia. While the Party claims that Oceania has always been at war with Eurasia, Winston can clearly remember a time, four years ago, when Oceania and Eurasia were in alliance. This knowledge, however, exists only in his "own consciousness" because the Party has rewritten history so that this alliance never happened.
It is this manipulation of the truth, or "reality control" as Winston calls it, that contributes to the Party's everlasting and totalitarian power. It can make people believe whatever it tells them because it rewrites history accordingly.
It is also worth looking at the text from Emmanuel Goldstein's book which appears in the last chapter of Part Two. In the following quote, Goldstein further explains the Party's control of the past:
"The past is whatever the records and the memories agree upon. And since the Party is in full control of all records and in equally full control of the minds of its members, it follows that the past is whatever the Party chooses to make it."
From Chapter 2 of the online source linked below:
O'Brien was looking down at him speculatively. More than ever he had the air of a teacher taking pains with a wayward but promising child.
'There is a Party slogan dealing with the control of the past,' he said. 'Repeat it, if you please.'
'"Who controls the past controls the future: who controls the present controls the past,"' repeated Winston obediently.
This quote also appears in Chapter 3 (from the same source).