After you defeat the four dungeon bosses and rescue the Four Giants, you have to do something about the moon.
Use the Oath to Order
After you have collected all of the things that you want to collect in the game, such as Pieces of Heart and Masks, go to the Clock Tower at midnight on the final day. You can get to the top by walking up the ramp next to the postbox in South Clock Town, then walk up the stairs after midnight.
On the top of the tower, there will be a cutscene. Afterward, play the Oath to Order and watch the cutscene that follows.
The Moon Children
Inside of the moon, there are four children running around, and one sitting under the tree in the center. The four that are running around are wearing the masks from the defeated dungeon bosses: Odolwa, Goht, Gyorg, and Twinmold. The child under the tree is wearing none other than Majora's Mask. I wonder what their faces look like under the masks?
Talk to any of the children wearing a dungeon boss mask. These children will ask you to give them some of your masks. If you do, they will take you to a mini-dungeon that is similar to the dungeon where their mask came from. At the end of each of the moon children's mini-dungeons, you will get a Piece of Heart. You need to have collected all of the masks in the game to be able to complete all of the dungeons.
Odolwa Dungeon
Talk to the kid wearing the Odolwa Mask. Give him the number of masks he asks for and he will send you to the mini-dungeon. Walk forward to the pink flower and use it as a Deku Scrub. You can go over to the ledges that have Gossip Stones on them and use the Mask of Truth to talk to them, but they just give you hints about where to get the different masks in the game if you don't have them all. Otherwise, wait in the flower until a spinning flower starts spinning toward you. Then pop out of the flower and float to the nearest pink flower in the spinning thing.
From there, you want to get into the yellow flower on the spinning thing up ahead. Watch the spinning item and pop out of the flower when the yellow flower is coming toward you. From the yellow flower, pop out and float over to the ledge where there is a Piece of Heart. Then float back to the yellow flower on the spinning thing. Use the yellow flower to float to a nearby ledge that has a door in the wall. Go through that door.
Talk to the Odolwa child and give him the number of masks he asks for. You will be returned to the moon.
Goht Dungeon
Find the child wearing the Goht mask and talk to him. Give him the number of masks he asks for.
In the mini-dungeon, become a Goron and stand between the nearby pots. Roll along the long path that goes into the darkness. Keep rolling and you will bounce off of some treasure chests. Continue rolling straight ahead until you break some green magic jars on the way. When you reach that spot, turn right and then left to stay on the path. You will see another curve ahead. You can stop there, and walk around the curve. When you see another straight path after that, roll straight along it. Eventually you bounce off of some chests. Keep going straight until you go over a Gossip Stone and reach a Piece of Heart.
After you get the Piece of Heart, find a set of pots along the wall and stand between them. Then turn to face the long straight path. Roll along that path until you reach some magic jars. Look for the bridge next to those magic jars. Cross that bridge and keep going straight (don't step on the warp spot) and then roll along the second bridge. You will go over a ramp and end up at a door. Go through the door.
Give the Goht child the number of masks he asks for. You will be returned to the moon.
Gyorg Dungeon
Find the child wearing the Gyorg Mask. Give him the number of masks he asks for.
In the mini-dungeon, become a Zora and jump into the water. At the forks, swim right, left, left, left. You will reach a Piece of Heart (it's behind the Gossip Stone). Jump into the water behind the Gossip Stone and swim forward to go back to the beginning. From there, get into the water again and swim left, left, right, right. You will find the Gyorg Mask kid. Talk to him and give him the number of masks he asks for. You will be returned to the moon.
Twinmold Dungeon
Find the child who is wearing the Twinmold Mask. Give him the number of masks he asks for.
In the mini-dungeon, go to the left and open the door. Kill the Dinofols that drops from the ceiling. The Great Fairy Sword kills it with one hit, and also a Goron Ground Pound kills it with one hit. Afterward, go through the next door. You can wear the Mask of Truth (if you still have it) to talk to the Gossip Stone in this room and get a hint about where to find all of the masks in the game. But otherwise, just go through the door beyond the Gossip Stone. In this room, you fight Garo Master again. Sidestep when it charges forward, then hit it when it is standing around looking for you. If it disappears, run away, then turn around and attack it. When it dies, it explodes, so stay away. After you defeat Garo Master, use the hookshot on the chest that appears. Open it to get arrows. Go through the door behind the chest. Go past the Gossip Stone (talk to it if you want) then go through the door behind it.
In this room, you fight Iron Knuckle. Hit it to start the battle. Get close to make it do an attack, then jump backward or run away before it can hit you. Attack it after it attacks. Repeat the process when part of its armor falls off, but keep in mind that it can move more quickly. When it dies, open the chest that appears. You get Bombchus. There is a cracked piece of wall to the right. Use a Bombchu to bomb it, then use an arrow to hit the diamond eye in the wall there. A ladder appears. Climb it and go through the door up above. Get the Piece of Heart in this next room. Then use a Bombchu to bomb the cracked ceiling. Use a fire arrow to hit the frozen diamond eye. Go through the door that opens. Give the Twinmold child the number of masks he asks for.
Start the Final Boss Battle
Talk to the Majora's Mask kid, who is sitting under the tree. If you are ready to fight the final boss, say yes when he asks you to play. If you collected all of the masks in the game and gave them all away to the Moon Children, and if you completed all four of their mini-dungeons, the Majora's Mask kid will give you the Fierce Deity's Mask. This mask transforms you into Fierce Deity Link, who wields a powerful two-handed sword that shoots sword beams. The game is very easy to beat if you use the Fierce Deity's Mask (just use sword beams over and over), so if you want a challenge, you might want to refrain from using it.
After you talk to the Majora's Mask kid and agree to play, you will be taken to a chamber where you fight the final boss, Majora.