Instructions
Place the Shadow Pokemon in your party and leave it there at all times.
Use the Pokemon in battle to raise its heart gauge. Occasionally, it may go into "Hyper Mode" and ignore your commands. By calling out to it with the "Call" command, you can snap the Pokemon out of "Hyper Mode" and raise its heart gauge significantly.
Fill up the heart gauge. After a few battles, the heart gauge should be maxed out. Once the heart gauge is filled, take the Pokemon to Celebi's Shrine in Agate Town. There, a short cutscene will take place and the Pokemon will be purified.