Here's how it works:
1. Defeat the Gym's trainers. Work your way through the trainers in the Cinnabar Gym until you reach Blaine.
2. Battle Blaine. Blaine will challenge you to a Pokemon battle.
3. Defeat Blaine. Once you defeat him, he will give you the "Key" as a reward.
With the key, you can then unlock the door to the Gym's main area and proceed to challenge Blaine for the Volcano Badge and the TM for Fire Blast.