Digestive enzymes attach to food in order to break down the specific sources of energy such as fats, carbohydrates, and proteins. Pepsin which is responsible for breaking down proteins in the stomach thrives in an acidic environment. Once it goes down with the food to the small intestine, which has an alkaline environment, it gets denatured.
Extreme temperatures also contribute to the denaturing of enzymes.