From the Super Mario Wiki
“I have sunken treasure here, I do! But to pluck the plunder, you must open the treasure chests in the right order.”
Treasure Chests (often referred to as Treasure Boxes) are scattered throughout Mushroom World in many different games. Some hold the most mundane of items while others hold unique items needed to complete a quest.
Super Mario series
Super Mario Bros. 3
Treasure Chests first appeared in Super Mario Bros. 3. They were usually seen inside of Toad Houses, and when opened, they would reveal a Power-Up that could be used later on in the game. In this game, Toad simply refers to them as boxes.
Super Mario 64/Super Mario 64 DS
Treasure chests also appeared in Jolly Roger Bay and Dire, Dire Docks in Super Mario 64 and its remake, Super Mario 64 DS. If a character touched one of these Treasure Chests in the wrong order, he would be shocked and stunned, but if he touched them in the correct order, he may have gained either Bubbles, a Power Star, or have caused water to drain.
Super Mario Galaxy
In Super Mario Galaxy, treasure chests appear as either optional items or something needed to progress through the level, such as a Launch Star. They can be opened by throwing shells at them. Shiny Treasure Chests also appeared in that game. Some chests contained Coins, Star Bits, a Launch Star, a 1-Up Mushroom, or just a bubble. One chest in the Bigmouth Galaxy is a Golden Treasure Chest that can only be opened by a Golden Shell. Many chests can be found underwater.
New Super Mario Bros Wii
In New Super Mario Bros. Wii, treasure chests were featured in the Enemy Courses where Bowser stashed Princess Peach's captured helper Toad. After collecting all 8 Toad Balloons the chest would open freeing Toad who would give Mario three Super Mushrooms as thanks. Treasure Chests also appear in Yellow Toad Houses, where they contain a Star.
New Super Mario Bros. 2
Super Mario Galaxy 2
New Super Mario Bros. U
Treasure Chests return in New Super Mario Bros. U, where they can be found in Enemy Courses, like the first game. However, they only contain a Starman instead of Toad. If the player takes too long to collect the Starman, then Nabbit will appear and steal it. They also appear behind the end-of-level fortresses when the player get the same two digit numbers on the timer and the end of the level. Toad would be standing behind it and would give what is inside, which is a random item to add to the inventory.
Donkey Kong Country 2: Diddy's Kong Quest
Treasure Chests also appeared in Donkey Kong Country 2: Diddy's Kong Quest, where they were used to throw at enemies. After hitting an enemy, they would break apart and leave an item, such as a Banana Bunch.
Super Mario RPG: Legend of the Seven Stars
In Super Mario RPG: Legend of the Seven Stars, Treasure Chests hover in the air (just like ? Blocks), and must be hit from below. They can contain coins, items, mushrooms, weapons, and even monsters. These monsters are Pandorite, Hidon, Box Boy and Chester. A golden Treasure Chest is in the last area of Bowser's Castle, created by Magikoopa after the player defeats him. The chest contains an infinite amount of Coins. Surprise Boxes, special invisible Treasure Boxes, also appear in the game.
Wario Land 4
In Wario Land 4, three Treasure Chests are found in each of the four main boss rooms, embedded into the wall in the background. During the boss battle, when time starts to run low, the Treasure Chests in the background will begin to disappear, one by one. Once Wario defeats the boss, the Treasure Chests that are left over are collected and stored in the Golden Pyramid. When facing the Golden Diva, the last boss, all twelve Treasure Chests can be seen on the background wall. When the Diva is defeated, the total Treasure Chests Wario has at the end of the game will affect how beautiful Princess Shokora is in the ending cut-scene.
In Wario World, each Treasure Chest contains one of Wario's sixty-four treasures. However, each Treasure Chest is linked to a Treasure Button, which must be activated before the treasure can be collected.
Wario: Master of Disguise
In Wario: Master of Disguise, treasure chests are a key element of the game. They come in three colors: red (which hold treasures), green (which hold upgrades like Guise Gems), and purple (which hold key level items, like maps and keys). In order to get the treasures in the chest, the player must win a mini-game, which become harder on later levels. Treasure Pests replace one random red chest starting at the third level, requiring the level to be replayed to get that treasure.
Wario Land: Shake It!
Treasure Chests also appeared in Wario Land: Shake It!. Wario could open them by performing a dash attack. In the level Boogie Mansion, however, the chests were living creatures, which would eat Wario if he got too close to them. Wario had to use an explosive to get the treasure inside those living chests.
Paper Mario series
In the Paper Mario series, Mario could find many Treasure chests on his adventures. They contain either Badges or Keys. In very big Treasure Chests, there are weapon upgrades such as Super Boots or Ultra Hammer. There is another type of Treasure Chest called the Black Chest, which appears in The Thousand Year Door. These chests contain demons which "curse" Mario with various abilities. Several Boos also appear in Treasure Chests in Boo's Mansion and Creepy Steeple. In Super Paper Mario, Pixls also appear in chests.
In Luigi's Mansion, treasure chests appear after Luigi beats the ghost(s) in a room. Blue Treasure Chests contain Keys. Green ones contain many Coins, Bills and possibly Gold Bars. If the green-hatted plumber defeats an optional gallery ghost, he will also receive a green chest with a Silver Diamond inside, among other treasures. Red Treasure Chests contain Mario's dropped Items that need to be taken to Madame Clairvoya. There are many red Treasure Chests in the Hidden and Sealed Rooms as well, though many in the former contain ghosts. A white chest exists in the Tea Room, containing the Ice Elemental Medal. There are also gold chests revealed after defeating bosses, which contain area Keys.
Mario & Luigi series
Mario & Luigi: Partners in Time
In the past Bowser's Castle in Mario & Luigi: Partners in Time, there is a treasure chest reminiscent of the ones from Super Mario RPG: Legend of the Seven Stars near the Time Hole containing one of the six Cobalt Star shards. After hitting the chest, however, it disappears.
Mario & Luigi: Bowser's Inside Story
In Mario & Luigi: Bowser's Inside Story, treasure chest-like enemies known as Trashures and Dark Trashures appear in certain levels. When they are low on HP their locks will fall off and they will open their mouths, revealing their treasure, Bowser can then inhale their gold coins by using the Vacuum command.
Mario Party 7
In Mario Party 7, treasure chests come into play on the Neon Heights board. There are initially three of them in play, spaced out at random spots along the board. One chest contains a Star, another holds twenty coins, while the other houses a Bob-omb. Koopa Kid guards the chests, but can be bribed into awarding the contents of one in exchange for ten coins. If the Bob-omb is found, the player (or team) will be blown back to the start of the board. If the Star is found, a new chest containing a Star will appear elsewhere on the board. The other two chests will then be shuffled around as well, or added to the board if they've already been claimed. There is also a Bowser Time event exclusive to Neon Heights in which Bowser will steal either a Star from the lead player, or ten coins from each player, then order Koopa Kid to stash what was stolen in the chest that already contains either the Star or twenty coins, which can them be recollected by whoever opens the respective chest. There is also the Neon Heights-exclusive Lakitu Orb. Using it will trigger Lakitu, who will select a chest at random and bring it to the player, who can open it on the spot without having to pay Koopa Kid. Treasure Chests also appeared in the Single-Player Bowser Mini-Game Treasure Dome where players must open each chest by using a key.