Why do some viruses try to make oyu sick? If they are severe enough to kill you... then they just kill themselves.
They don't have will. But there are so many viruses, so some of them will mutate and cause disease. Over time, they will become less deadly because of evolution though. The diseases that kill the organisms they infect won't be able to spread so easily, so it's more beneficial not to kill.
(And, of course, if the disease becomes a problem for a species, natural selection will also select those within the species that have better defenses against the virus).