We don't know. We can't really study how they evolved because they don't leave fossils. There are several different theories as to how they evolved - they could have been bits of cells, or random self-reproducing molecules, or particular cells that lost all of their useful parts except for DNA/RNA.
answer 2:
Probably viruses exists longer as life (a we define it today) itself. Probably the first mechanisms of life are early forms of DNA/RNA without a skin. I think the earliest forms of life started in an area with a source of the same building blocks and an area dense but liquid enough to carry them like water. To me it sounds logical that futher away from this source, where building blocks became scarce, these molecules could not reproduce anymore. By time, chance and exemplary differences, only the ones that adapt to the changed environment could carry themselfs futher away, benefit from that and adapt (develop) even more. The ones that developed a skin which acted like a sealed buffer with building blocks as a reserve within and became more self supporting, could carry itself to other places and develop even more from that. This cellular form of life is related to the life as we know it today and is also more developed and abundant. Probably the skinless forms didn't go away completely. They invaded those buffers and made use of it as well and now they still exists as viruses today.
Interesting to know is that sea is full of viruses (1 to 10 billion per 1 liter of water) and play a large role in that ecosystem.
a host cell so that the virus is able to use the host's cell machinery to replicate
Viruses must infect a host cell in order to replicate. Once inside the host cell, the virus can hijack the cell's machinery to produce new viral particles. Without a host cell, viruses are unable to replicate.
A virus will replicate within a host cell.
Viruses replicate by hijacking a host's cells. The virus inserts its own RNA sequence into the host cell's nucleus, forcing it to replicate the virus until the host cell dies.
The cell invaded by the virus is called a host cell because it provides the environment and resources necessary for the virus to replicate and multiply. The virus uses the host cell's machinery to produce more viruses, ultimately leading to the destruction of the host cell.
The cell infected by a virus is referred to as the host cell. The virus hijacks the host cell's machinery to replicate and produce more virus particles.
A virus replicates its DNA in a cell when it infects the host
The virus enters the host cell and uses the cell's machinery to replicate itself.
A virus outside a host cell is generally referred to as a virion. This is the inactive form of the virus that is unable to replicate until it enters a suitable host cell.
Viruses are intracellular because they need to hijack the cellular machinery of a host cell in order to replicate and produce more virus particles. They cannot replicate on their own and rely on host cells to multiply. Once inside a cell, a virus releases its genetic material and uses the host cell's resources to replicate.
Viruses do not breathe because they are not living organisms. They are considered particles that need a host cell to replicate and survive. Once a virus infects a host cell, it uses the cell’s machinery to replicate itself.
Viruses do not directly need energy. The virus takes control of the host cell in order to replicate. The host cell's own metabolic machinery is used to synthesize the components of new viruses. The virus itself is passive.