Why do DNA and RNA have the functions they have?
DNA is more chemically stable than RNA, which makes it ideal for long-term storage. RNA viruses like HIV have a short lifespan and must replicate to survive, which is why they can get by with a less chemically stable genome.

RNA is a useful format to transcribe since it has multiple forms and functions (e.g. rRNA, mRNA, tRNA, siRNA, snRNA, miRNA, etc.). RNA can sometimes function like a protein in which it carries out cellular actions without needing to be translated. It has been hypothesized that RNA were the first molecules as precursors to life since they can function for both storage and action. The theory is that RNA was the first molecule but was then able to be translated into proteins (which were more variable/useful) and able to be stored as DNA (which was more stable as a storage medium).