No, it doesn’t happen accidentally. But no scientist thinks that it does. Such accusations are the fodder for many creationist screeds, but they are far from reality. DNA did not suddently arise de novo from the ooze; it was (in a very abbreviated version) the culmination of many tiny chemical steps, starting with simple molecules and moving through self-replicating molecules that grew more and more complex, through RNA molecules, and then to DNA.