The Magic Powder is an item that is present in both A Link to the Past and Link's Awakening. It is kept in a bag and has limited uses. It is mainly used to change enemies into something else, such as turning a Buzz Blob to a Cukeman. It can also set things on fire.
A Link to the Past
A short time after Link gives the Witch a Magic Mushroom for her Mushroom brew, the Witches Apprentice inside of the Potion Shop will have a bag of Magic Powder read for him."
In Link's Awakening, the Magic Powder is required to receive the Tail Key. Link must find the Sleepy Toadstool in the Mysterious Woods, and then he can take it to the Witch's Hut in Koholint Prairie. She will mix up the Magic Powder for him. He can use it 20 times before it runs out, and he can pick another toadstool and bring it to the witch to get more. Another option is to win the Magic Powder in the Trendy Game Shop.