There's a widespread theory, romantically called RNA World (like water world, but with fewer humans), that says RNA may have been the first kind of genetic code for early life on Earth. Since it's a single- rather than a double-stranded molecule, it's less stable than DNA, but it's able to do something that DNA is not. It can self-replicate. And it can fold up into a kind of pseudo-enzyme, which can help run chemical reactions. These extra functions make it an attractive candidate for the first genetic molecule. Plenty of viruses today use RNA, not DNA, to survive, and they do alright for themselves. It's not enough to make a complex biological organism, but it could have been sufficient for early life.