How does Majora's Mask fit into the timeline?
There are several "theories" about the timeline of the Zelda franchise, and all do make sense in their own ways. The interesting thing to note is that the timeline actually splits after Ocarina of Time.
Nintendo actually did release an official timeline for the Zelda franchise:
However, some believe that this is incorrect, and a different timeline has been created, though this is... just a game theory...
But to answer your question: "Where does MM fit into the timeline?" It is a direct sequel to OoT (by direct I mean it is one of the games that occurs directly after the events of OoT).
At the end of OoT, Link returned the titular Ocarina of Time to Princess Zelda. After that, Link is seen in front of the Master Sword stuck in the Pedestal of Time as a kid, which essentially means he's returned to the past. Navi leaves Link, and Link walks away from the sword.
You can skip to 8:54 to see the scene in question.
At the very beginning of Majora's Mask, we get to see a bit of backstory. It explains how Link became the Hero of Time, and how he's now looking for a friend he parted ways with when he finally fulfilled his heroic destiny and took his place among legends.
Since the game begins in the Lost Woods, it is likely the friend Link is looking for is Navi, who indeed left him behind at the Temple of Time after he has finally fulfilled his heroic destiny.