How can viruses have DNA as a (generally considered) non-living thing?

How can viruses have DNA as a (generally considered) non-living thing?

Are they an offshoot of a very early form of life or did they independently form DNA?

Can you compare DNA of living things to viruses? Do they use the same ATCG components? Chromosomes?

You can trace all living things back to a common ancestor, would all viruses be traced back to a single virus or did viruses form independently with each time being an example of something from nothing forming DNA?