This paper shows how a new theory of epidemics can be developed for viral pandemics in a globally interconnected world. The study of the in-host dynamics and, in parallel, the spatial diffusion of epidemics defines the goal of our work, which looks ahead to new mathematical tools to model epidemics beyond the traditional approach of population dynamics. The approach takes into account the evolutionary nature of the virus, which can generate pseudo-Darwinian mutations and selection, while learning the presence of the virus and activating adaptive immunity. The study of immune competition plays a key role in both the in-host dynamics and the contagion dynamics.