Dusknoir is a Pokémon who came from the future. Early in the story, he is thought of as a friend and even a celebrity, but he is later revealed to have been deceiving everyone. In reality, he was an agent of Primal Dialga, sent to the past in order to capture the protagonist and Grovyle in order to stop them from altering history and preventing the planet's paralysis.
Time in the future was frozen because Temporal Tower had collapsed. In order for Grovyle to prevent the planet's paralysis, he would have to journey to the past and employ the Time Gears to preclude the tower's collapse. This, in turn, would have a cataclysmic effect on the current future. If history were changed, then the current future would be forced to disappear. This includes Grovyle, Dusknoir, Primal Dialga and the player itself.
Dusknoir is shown to be a character with a very strong sense of self-preservation. Believing Dialga to be the most powerful Pokémon, he surrenders himself to Dialga's will. Moreover, he is particularly ardent in the defense of the dark future because he will cease to exist if history is altered.
Additionally, it should be noted that a group of no less than six Sableye tends to accompany him as he carries out his master's will. Six of them fight alongside Dusknoir in the Old Ruins, and six of them are present for the player's execution, however it is implied that others were present in the future.