Method #1
The first documented and most commonly known method to perform the Mew glitch involves the Gambler on Route 8, who is facing north towards the Underground Path entrance, and the Youngster on Route 25 who is facing north and has a Slowpoke on his team. The player must have defeated neither Trainer before, and must also have a Pokémon who can use Fly on their team.
The player must stand directly beneath the Underground Path entrance door, at which point the aforementioned Gambler will be exactly one tile offscreen. It is recommended that the player save the game at this point in case a mistake occurs in a future step. The player then can begin the glitch by taking one step down, and then pressing and holding the Start button while the step is occurring. The Gambler will be scrolled onto the screen during this process and the player will enter his line of sight, but the start menu should appear before the Gambler "sees" the player.
From the start menu, the player must Fly away (with the most convenient location being Cerulean City). If the previous steps have been performed correctly, the Gambler will have the indicative exclamation mark appear above his head, but then the Fly animation will begin before he can walk up and challenge the player.
After landing in Cerulean City, the Start, A, and B buttons will not function properly, as the game believes that the player is about to be in a battle. From here, the player should walk to Route 25 and battle the aforementioned Youngster. Importantly, the Youngster must walk up to the player (must have at least 1 tile between the player and the Youngster when the player is spotted) to initiate the battle, or else the game will soft lock.
After battling the Youngster, the previously disabled buttons will now work again. The player must now return to Route 8 (with the most convenient method being Flying to Lavender Town and heading west). Upon entering the Route, the start menu will appear by itself; closing the menu will immediately begin a battle with a wild Level 7 Mew.
If the game is saved and reset during the glitch, or the player returns to Route 8 after Flying but before battling, or if any battle occurs or any NPC is interacted with between the time of the Youngster battle and the Mew encounter, then the glitch will not work and the game must be reset to before Flying from the Gambler.
Method #2
This alternate method is sometimes known as the Quick Mew glitch, as it allows the player to obtain Mew at the earliest possible point in the game.
It is very similar to Method #1, except that the Jr. Trainer on Route 24 west of Nugget Bridge should be used in place of the Route 8 Gambler, and the first Swimmer in Cerulean Gym used in place of the Route 25 Youngster. As Fly is not available at this point in the game, the player must catch an Abra and use its Teleport in place of Fly.
At the end of the glitch, the player should return to Route 24 rather than Route 8, as that is the area where the glitch began.
Source