Enzymes are folded into complex 3D shapes that allow smaller molecules to fit into them. The place where these molecules fit is called the active site.
In the lock and key hypothesis, the shape of the active site matches the shape of its substrate molecules. This makes enzymes highly specific. Each type of enzyme can usually catalyse only one type of reaction (some may catalyse a few types of reactions).
The diagram shows how this works. In this example, the enzyme splits one molecule into two smaller ones.
If enzymes are exposed to extremes of pH or high temperatures the shape of their active site may change.
If this happens then the substrate will no longer fit into the enzymes. This means the key will no longer fit the lock. We say that the enzyme has been denatured.