Loops are small secondary structural elements that play a crucial role in the emergence of new enzyme functions. However, the evolutionary molecular mechanisms how proteins acquire these loop elements and obtain new function is poorly understood. To address this question, we study glycoside hydrolase family 19 (GH19) chitinase—an essential enzyme family for pathogen degradation in plants. By revealing the evolutionary history and loops appearance of GH19 chitinase, we discover that one loop which is remote from the catalytic site, is necessary to acquire the new antifungal activity. We demonstrate that this remote loop directly accesses the fungal cell wall, and surprisingly, it needs to adopt a defined structure supported by long-range intramolecular interactions to perform its function. Our findings prove that nature applies this strategy at the molecular level to achieve a complex biological function while maintaining the original activity in the catalytic pocket, suggesting an alternative way to design new enzyme function.