There really isn't much of an explanation for this. Ultimately, this boils down to being one of those elements of the game that's simply done for game design. Some Zelda games have actually had loose keys, particularly the handheld titles, where you just collect the key or do something to make it drop and then collect it. But several of the games generally only give you items straight out of chests, so Nintendo sticks the keys in other chests to avoid changing this. Pretty much none of the chests are locked, anyway, so just think of it as a container or box.
It would be nice to see an element of realism to this. Despite the fact that Twilight Princess was probably one of the worst culprits of what you're describing, it also did have keys given to you in more interesting ways from time to time, and when that did happen it was oddly satisfying and just felt good. Would be cool if they did that more in a Zelda game. Would make that game feel more unique and realistic, and if they did it creatively, it would make all the dungeons of the game even more varied and interesting.