White did not "lose" the bishop, white traded the bishop for another, which in this case was a fair trade because otherwise black would've had a dominant bishop on e5 pointing towards white's king. After black recaptures with 20...Nxe5, black replaces an Active Piece with another Active Piece. White does best to recapture because it would simplify the position where white might be able to draw despite being down a pawn.
Why does the engine recommend to recapture even when there are more attackers than defenders?

I don’t see a good square for the knight. Not that retreating is horrible or anything but white can proceed to play f4 hitting the queen. White wins a tempo, gains space, still controls the only open file, and in general appears to be more active in that position. that’d be my guess

I was doing low rated puzzles and this puzzle on lichess
https://lichess.org/training/LSpg9Had me questioning why the engine move was 20...Nxe5?, In my mind White has just lost the bishop, why does losing the the knight as well improve his position ?, it would make more sense to me that you just move the knight away.
Doesn't seem to be an engine move to me, the engine recommends trading the rook for the bishop and the knight, winning material, the bishop capture was a blunder made by a human. All puzzles are taken straight from real games...
I was doing low rated puzzles and this puzzle on lichess
https://lichess.org/training/LSpg9
Had me questioning why the engine move was 20...Nxe5?, In my mind White has just lost the bishop, why does losing the the knight as well improve his position ?, it would make more sense to me that you just move the knight away.