In a fight, everyone is constantly watching for a chance to strike an enemy who is fleeing or passing by. Such a strike is called an Opportunity Attack.
Making an Opportunity Attack
You can make an Opportunity Attack when a hostile creature that you can see moves out of your range or moves more than 1 square within your range. To make the Opportunity Attack, you use your Reaction to use the Basic Attack maneuver against the provoking creature. The Attack occurs right before the creature leaves your range.
Avoiding an Opportunity Attack
You can avoid provoking an Opportunity Attack by taking the Disengage Action. You also don't provoke an Opportunity Attack when you teleport or when someone or something moves you without using your movement, Action, Bonus Action, or Reaction. For example, you don't provoke an Opportunity Attack if an explosion hurls you out of a foe's range or if gravity causes you to fall past an enemy.