How did DNA evolve?

That is one of the greatest mysteries of of all time. Nobody knows for sure. There are various theories, but not one has been substantiated.