You can obtain HM02 Fly by defeating your Rival on Route 119. You’ll encounter your Rival (Brendan/May) near the Weather Institute on your way to Fortree City.
But before you can use Fly outside combat you must beat Fortree City’s Gym Leader Winona.
HM02 Fly Location (Step-by-Step)
The rival battle where you get HM02 Fly will be on Route 119.
This is located between Route 118 and Fortree City. When you defeat Brendan/May, they’ll reward you with HM02 Fly.
At first, the bridge that leads to the battle with your Rival is blocked by Team Aqua/Magma Grunts. You’ll need to deal with them inside the Weather Institute to unblock the path.
Once that’s done, here’s how to meet up with your Rival:
Step 1: Start at Route 119’s south entrance.
Step 2: Follow the path heading North.
Step 3: Cross the bridge going West.
Step 4: Head North until you see the Weather Institute.
Step 5: Cross another bridge going East.
Step 6: Head up the stairs, and your Rival will challenge you!
Using HM02 Fly Outside of Combat
While the HM Fly is a decent move in battle, it’s especially helpful when used out of combat.
Because you can fly to any location you’ve been to before. Unlike in previous generations, you can now fly to routes directly in addition to cities and towns.
You need to have received the Feather Badge from Winona, the sixth Gym Leader from Fortree City, to use Fly outside combat.
Now that you can easily travel across Hoenn, you can travel back to Littleroot Town and talk to your Mom. She’ll give you an Amulet Coin. If a Pokémon holding this item is used in a Trainer battle, you’ll double the prize money you earn from defeating them.