The origin of viruses is an interesting subject. Nature magazine published a review geared towards the public for it:
Origin of Viruses | Learn Science at Scitable
Whether viruses are living or not is still a matter of debate. The most important question, in my opinion, is to ask whether you can really define something like life in such a binary manner in the first place. Maybe it's more appropriate to talk about lifeness and say that viruses have a small amount of it, but not quite to the level of cellular-based life. In other words, maybe we should model life as a spectrum instead of a yes/no question.