The main character (you) is a human turned into a Pokemon. How this happened either isn't explained or is at some point in the post-credits chapters. Which Pokemon you are depends on how you answer some questions asked at the beginning (and if you're male or female).
The main character awakens with no memories but their name, and that they were once human. They're found by the 'partner Pokemon', which you choose from a randomly generated list given to you once you're assigned the player character.
The main quest behind the story is to restore the rightful flow of time. As I've previously mentioned, it's revealed that some of the characters have travelled from the future, either to preserve the timeline (which becomes a dystopian world ruled by an insane Dialga, where the whole planet is paralysed), or restore time in the present, breaking the current timeline.
Of course, it's revealed that by breaking the current timeline, Pokemon from the future will no longer exist (although memories of those Pokemon do persist). And it seems that the main character is also from the future.
Of course, you and the partner Pokemon manage to restore time (beating a maddened, but not yet insane, Dialga to do so), and the main character fades away. After being a heroic mime for the entire storyline, the main character actually speaks dialogue, saying how much they enjoyed their time with their partner. They tell the partner to carry on, and to let everyone know what happened, so that time's flow isn't threatened again. The main character fades away, and the partner staggers off in a daze, muttering to itself that they need to get back, to fulfill the main character's last wish.
The story jumps a few months forward, and has the partner seemingly coping. Then they go down to the beach where they first met the main character. The memories of their adventures with the main character wash over them, and they break down sobbing on the shoulder of a NPC.
At which point the credits start. With upbeat music. RAGE
After the credits, you see Dialga in the final dungeon. He states how he can still sense the sorrow of the partner Pokemon after so long, and how strong it is. So, in respect for the service they did him, he'll give them a gift. The gift of the future. Dialga roars.
The main character slowly fades into view on the beach that the partner is on. They see each other, and run towards each other, and the partner starts sobbing on the shoulder of the player character.
Now, I was teary from the moment the main character stopped being a heroic mime, but this last bit did actually make me sob myself. ...Actually, I'm getting teary over it again now.
It probably didn't help that I named the player Pokemon after myself (off course), and the partner after a friend who's like a sister to me...