Strains of influenza viruses spread in human populations during every season of epidemics. As the infected population size increases, the virus can mutate itself and grow in its strength. The traditional epidemic Susceptible-Infectious-Recovered model does not capture the mutations of viruses, and hence the model is not sufficient to study epidemics where the virus mutate at the same timescale as the epidemic process. In this work, we establish a novel framework to study the epidemic process with mutations of influenza viruses, which couples the Susceptible-Infectious-Recovered model with replicator dynamics used to describe virus mutations. We formulate an optimal control problem to study the optimal strategies for medical treatment and quarantine. We obtain structural results for the optimal strategies and use numerical examples to illustrate our results.