Mahir Emreli's 10th goal of the season gave the Polish champions a 1-0 victory on Thursday.
Jannik Vestergaard missed the Foxes' best chance and they are left facing an uphill battle in Group C.
Only the group winners go through automatically this season and the Foxes - who travel to Spartak Moscow in October - have one point from their opening two games, five points behind leaders Legia.
Despite boss Brendan Rodgers making six changes from Saturday's 2-2 draw with Burnley Leicester were lethargic for long spells of the first half.
Legia made a fast start and Daniel Amartey was forced into a hurried early block on Mattias Johansson before the hosts escaped after 10 minutes.
Cezary Miszta missed Kieran Dewsbury-Hall's corner but Ayoze Perez could only turn the ball back to the goalkeeper.
Patson Daka - starting after Kelechi Iheanacho was barred from entering Poland on Wednesday due to a problem with his travel documents - struggled to make an impact as the Foxes' slow build-eup hampered their efforts.
But a cagey game burst to life when the hosts grabbed the winner after 31 minutes.
The Foxes continued to struggle without injured first-choice centre-backs Jonny Evans and Wesley Fofana and it was another poor defensive showing which allowed Legia to score.
Amartey was bullied off the ball too easily by Emreli and the striker drilled a low 16-yard effort through Vestergaard's legs and in off the post.
Leicester, who lost a 2-0 lead against Napoli to draw their opener 2-2 earlier this month, needed to up their tempo and they should have levelled 10 minutes later.
Youri Tielemans seized on a loose ball to find Daka and the striker's touch inadvertently teed up Perez but, with just the goalkeeper to beat, he dragged a poor shot wide.
Knowing they had struggled, the Foxes started the second half well and Perez had a goal disallowed after Amartey's foul three minutes in.
Kasper Schmeichel claimed Emreli's weak angled effort but the Foxes continued to ask questions and Vestergaard should have levelled with 24 minutes left.
The defender met Dewsbury-Hall's corner and his miscued header bounced off his shoulder, although Miszta still needed to make a smart save.
Boss Rodgers was forced to call for reinforcements with Harvey Barnes and James Maddison replacing Dewsbury-Hall and Perez.
Maddison quickly picked out Daka but the striker failed to get a clean connection and his shot dribbled wide, although it hinted at a late Leicester fightback.
It never came though and, after Maddison saw a shot cleared, Schmeichel stopped Lirim Kastrati from striking late when the winger cut inside, only for the goalkeeper to turn his shot onto the post.
Tomas Pekhart also should have finished the Foxes off when he blazed over after being found by Kastrati on the break.