In this work, we develop a mathematical framework for predicting and quantifying virus diversity evolution during infection of a host organism. It is specified as a virus density distribution with respect to genotype and time governed by a reaction-diffusion integro-differential equation taking virus mutations, replication, and elimination by immune cells and medical treatment into account. Conditions for the existence of virus strains that correspond to localized density distributions in the space of genotypes are determined. It is shown that common viral evolutionary traits like diversification and extinction are driven by nonlocal interactions via immune responses, target-cell competition, and therapy. This provides us with a mechanistic explanation for clinically relevant properties like immune escape and drug resistance selection, and allows us to link virus genotypes to phenotypes. © 2021 Society for Industrial and Applied Mathematics.