I got an extra key in Key Cavern
The extra key is a safeguard for earlier versions of the game where it was possible, through certain combinations, to incorrectly use your keys and make it impossible to finish the dungeon.
Key Cavern contains one more key than it does unlockable doors. The final Small Key in the dungeon drops from above automatically in the final room before the boss, when there is no use for it. If Link has not unlocked the optional rooms in this dungeon, it can be used to unlock them, although since both of them contain keys themselves and have no other purpose the end result will always leave Link with an extra key.
Source found on the Zelda Wiki
The key is a spare. You'll always have one extra if you explore the whole dungeon.
It's there because halfway through the dungeon, there is a branching pathway, with locked doors on all sides:
The right door takes you to the next part of the dungeon; all of the other doors are dead-ends with another key. There's nothing of value behind any of the doors other than some hearts (left), bombs (bottom), and the stone tablet/owl statue and crystal switch (top). The switch is useful if you want to go back and get the map or some Rupees, but it isn't required.
The extra key drops so you can go back and explore these rooms without being locked out forever. Since they all provide an extra key, though, you'll always have the spare.