The reason for the En Passant rule is that the original rules of chess allowed for a pawn move of only one square - not two, like the rules allow now.
So if you imagine someone moving only one square in the diagram above, the pawn would be able to be captured.
Over the years (hundreds) there have been some rule changes such as castling (which was not in the original rules of the game). The rules were changed to speed up the game. (Can you imagine how many moves and how clunky it would be to castle by hand - meaning getting all the pieces out of the way and getting you king safe in the corner.
So when they added the rule that allowed the pawns to move two squares in stead of just one, they recognized that unless they added the En Passant rule, someone could avoid being captured simply by moving two squares. They decided that the opponent should be able to capture the pawn, but only has the right to do so if they do it immediately.
HHHHAAAAAAAACKKER
lol