Time Gears are ancient relics of great importance in the Pokémon Mystery Dungeon series. Their sole purpose in existence is to regulate the flow of time within the Pokémon World. Once stolen from their specific area, the flow of time within that area alone will grind to a halt.
In the games a mysterious criminal is stealing the Time Gears, paralyzing several areas. It is discovered that a Grovyle is stealing the Time Gears, and a massive bounty is placed on his head. All exploration teams were called to catch this criminal, and a famous explorer named Dusknoir lent his great strength in capturing the criminal. However, after several time gears are stolen, Dusknoir told the story of him and Grovyle. According to Dusknoirs account of the story, Grovyle was a notorious criminal in the future. He fled to the past so he could stop time, and Dusknoir was sent to chase after him. After debating what to do, Dusknoir and the three mirage Pokémon( Azelf, Uxie. and Mesprit) devised a trap. The four of them went off to Crystal Lake and waited for Grovyle to strike, which he did.
When they captured Grovyle, Dusknoir opened a portal to the future(Called a Dimensional Hole) in Treasure Town. He was saying his farewells to the denizens of Treasure town, and wanted one last look at your character and your partner. As the two of you approach him, he grabs you and your partner and enters the portal. You soon find out that Grovyle is attempting to restore the balance of time, while Dusknoir is trying to stop him. When you return to the past you tell the guild that Grovyle is good, and he was stealing time gears to prevent the destruction of Temporal Tower. The guild thinks you are confused, and that you should go to bed. However, they decide to believe you in the end.
After a while you go to Brine Cave and find out there is a symbol on the wall and it reacts with you partner's Relic Fragment and Lapras who will give you a ride to the Hidden Land, where you may ride find Rainbow Stone Ship, which can ridden to Temporal Tower. There, you and your partner and Grovyle attempt to activate the Rainbow Stone Ship; however, Dusknoir and his Sableye attack you and Grovyle.
After defeating Dusknoir, he tries to attack you, but Grovyle takes the hit and tries to push Dusknoir into the portal leading to the future. Then, your partner comes back.
You and your partner then rode the Rainbow Stone Ship to the Temporal Tower. You go through Temporal Tower and fight Primal Dialga. After the battle, you place the time gears and prevented Temporal Tower from collapsing.