Arceus Pokedex: It is described in mythology as the Pokémon that shaped the universe with its 1,000 arms.
Basically Arceus created Dialga, Palkia, and Giratina, the universe, and all of the other legendaries (although there is no evidence of him creating the other legendaries, one can assume this, since they give no explanation as to where they came from). One of those legendaries just so happens to be the DNA thing Mew.
Also, Whether Mew is the ancestor of all pokemon is never set in stone. According to the pokedex, Scientists "think/believe" Mew is the ancestor, however it is never proved or stated as a fact.
In fact, Mew's Super smash bros. melee trophy states, "Some Pokémon scholars believe Mew to be the ancestor of all existing Pokémon, but the idea is debatable." Just saying.