The T790M mutation typically arises after an initial period of successful treatment with first-generation EGFR TKIs such as gefitinib or erlotinib. These drugs initially target the original EGFR mutations driving the cancer. However, as the cancer cells mutate further, the T790M alteration can develop, leading to drug resistance. This mutation changes the structure of the EGFR protein, making it harder for TKIs to bind effectively.