Is Bg5 a mistake or inaccuracy there? [FEN ""]
[STARTPLY "8"]

1. e4 e5 2. Nf3 d6 3. d4 Nc6 4. c3 Nf6 5. Bg5 h6 6. Bxf6 gxf6 7. Bb5 a6 8. Ba4 b5 9. Bb3 a5 10. O-O b4 11. a3 bxc3 12. Nxc3 exd4 13. Nxd4 Ne5 14. Re1 h5 15. h3 d5 16. Nxd5 f5 17. f3 Bc5 18. Ba4+ Bd7 19. Bxd7+ Qxd7 20. Nf6+ Kd8 21. Nxd7 Kxd7 22. Qc1 Bxd4+ 23. Kh2 Bf2 24. Rd1+ Ke7 25. Qxc7+ Ke6 26. Rd6# 1-0


I do not clearly understand the suggestion by Lichess computer analysis. What is the problem with the move 5.Bg5 if there is one ? Lichess computer analysis suggests me that 5.Bb5 was better, but my idea behind Bg5 was to defend e4 pawn and if you go for Bb5 you sacrifice the pawn and I do not see what compensation I have for it (I played for white). Thanks in advance.
Both 5.Bb5 and 5.Bg5 are reasonable here. Lichess wasn't running multiple move analysis, but it didn't mean the move 5.Bg5 was bad.

5.Bb5 doesn't lose a pawn as 5...Nxe4 6.dxe5 dxe5 7.Qxd8+ Kxd8 8.Bxc6 bxc6 9.Nxe5 is better for White.