Pepsin is secreted in its inactive form, pepsinogen, because it is a powerful agent for breaking down proteins and thus poses a risk both to unprotected parts of the body and itself. Pepsin is a protein compound, and laboratory samples of the enzyme must be kept cold to prevent self-digestion.
Pepsinogen is converted to pepsin once it comes in contact with the acidic environment of the stomach. Once it passes to the intestines, the acids from the stomach are neutralized and the pepsin becomes inactive again. Pepsin does cause damage in cases of stomach reflux, in which the contents of the stomach leak into the esophagus.