Media playback is not supported on this device
The 12 goals scored at the Westfalenstadion on Tuesday surpassed Monaco's 8-3 win over Deportivo La Coruna in 2003.
There were seven goals in 22 first-half minutes, and Marco Reus scored twice on his return from six months out.
Polish champions Legia became the first side to score four goals in a Champions League match and lose.
Dortmund captain Marco Reus celebrated his return after six months out with goals in the 32nd and 52nd minutes, while his shot was deflected by Legia's Jakub Rzezniczak into his own net in the 92nd minute.
"I was just happy to be there from the start," said Reus, who missed the 2014 World Cup and Euro 2016 because of injury.
"It is how you imagine your perfect comeback. I waited a long time for this and so it is even sweeter. The ball will be signed by everyone and will go on the shelf."
Match ends, Borussia Dortmund 8, Legia Warsaw 4.
Second Half ends, Borussia Dortmund 8, Legia Warsaw 4.
Own Goal by Jakub Rzezniczak, Legia Warsaw.  Borussia Dortmund 8, Legia Warsaw 4.
Attempt missed. Michal Kucharczyk (Legia Warsaw) right footed shot from outside the box misses to the right. Assisted by Jakub Rzezniczak.
Offside, Legia Warsaw. Tomasz Jodlowiec tries a through ball, but Michal Kucharczyk is caught offside.
Attempt blocked. André Schürrle (Borussia Dortmund) right footed shot from outside the box is blocked. Assisted by Marco Reus.
Corner,  Borussia Dortmund. Conceded by Radoslaw Cierzniak.
Attempt saved. Christian Pulisic (Borussia Dortmund) left footed shot from the centre of the box is saved in the centre of the goal. Assisted by Gonzalo Castro.
Christian Pulisic (Borussia Dortmund) wins a free kick on the right wing.
Foul by Jakub Rzezniczak (Legia Warsaw).
Matthias Ginter (Borussia Dortmund) is shown the yellow card.
Foul by Matthias Ginter (Borussia Dortmund).
Miroslav Radovic (Legia Warsaw) wins a free kick in the defensive half.
Attempt blocked. Christian Pulisic (Borussia Dortmund) left footed shot from outside the box is blocked. Assisted by Gonzalo Castro.
Offside, Legia Warsaw. Michal Kucharczyk tries a through ball, but Nemanja Nikolic is caught offside.
Goal!  Borussia Dortmund 7, Legia Warsaw 4. Nemanja Nikolic (Legia Warsaw) right footed shot from a difficult angle on the right to the bottom left corner. Assisted by Miroslav Radovic.
Foul by Erik Durm (Borussia Dortmund).
Bartosz Bereszynski (Legia Warsaw) wins a free kick in the defensive half.
Goal!  Borussia Dortmund 7, Legia Warsaw 3. Felix Passlack (Borussia Dortmund) header from the centre of the box to the bottom right corner following a fast break.
Attempt saved. André Schürrle (Borussia Dortmund) right footed shot from the centre of the box is saved in the centre of the goal. Assisted by Christian Pulisic.
Foul by Felix Passlack (Borussia Dortmund).
Jakub Rzezniczak (Legia Warsaw) wins a free kick on the left wing.
Foul by Matthias Ginter (Borussia Dortmund).
Miroslav Radovic (Legia Warsaw) wins a free kick in the defensive half.
Attempt saved. Nemanja Nikolic (Legia Warsaw) left footed shot from the centre of the box is saved in the centre of the goal. Assisted by Miroslav Radovic.
Pierre-Emerick Aubameyang (Borussia Dortmund) hits the left post with a right footed shot from the centre of the box. Assisted by Christian Pulisic following a fast break.
Substitution, Legia Warsaw. Nemanja Nikolic replaces Vadis Odjidja-Ofoe.
Attempt missed. Christian Pulisic (Borussia Dortmund) header from the centre of the box is high and wide to the left. Assisted by André Schürrle with a cross.
Sebastian Rode (Borussia Dortmund) wins a free kick in the defensive half.
Foul by Vadis Odjidja-Ofoe (Legia Warsaw).
Substitution, Borussia Dortmund. André Schürrle replaces Ousmane Dembélé.
Attempt missed. Christian Pulisic (Borussia Dortmund) right footed shot from outside the box is too high.
Substitution, Borussia Dortmund. Pierre-Emerick Aubameyang replaces Nuri Sahin.
Substitution, Legia Warsaw. Mateusz Wieteska replaces Aleksandar Prijovic.
Offside, Borussia Dortmund. Gonzalo Castro tries a through ball, but Nuri Sahin is caught offside.
Attempt saved. Miroslav Radovic (Legia Warsaw) left footed shot from outside the box is saved in the bottom left corner. Assisted by Vadis Odjidja-Ofoe.
Foul by Ousmane Dembélé (Borussia Dortmund).
Bartosz Bereszynski (Legia Warsaw) wins a free kick on the right wing.
Sebastian Rode (Borussia Dortmund) wins a free kick in the defensive half.
Foul by Vadis Odjidja-Ofoe (Legia Warsaw).
Borussia Dortmund beat Legia Warsaw 8-4 in the highest-scoring Champions League game in history.