Trinitrotoluene (TNT) is entirely formed out of carbon, nitrogen, oxygen, and hydrogen. Since we're talking about speculative biology here, I see no reason why TNT or a similar explosive could not be manufactured by some evolved process.
For a solution that exists in nature already: cows produce methane en masse (relatively) in their digestive systems. Methane is a viable rocket fuel, so I'd assume it could serve as explosive. We can imagine, then, a large, possibly pressurized "methane bladder" internal organ occupying a creeper's body. Elevated internal pressure, if necessary, could be maintained by building the walls out of a very dense, thick layer of tensile tissue (some kind of cartilage? tendon?)
To generate enough force to explode the creature, methane might be utilized in two ways:
- Pressurized methane is mixed with oxygen in the explosive bladder, then sparked when needed.
- Pressurized methane is excreted through vents or ruptures in the body that open up prior to detonation, blasting out methane to mix with atmospheric oxygen in the manner of a fuel-air variety of thermobaric bomb. This could also explain the explosion delay time.
For the sparking system, we might imagine something like the shock generating organ of an electric eel connected to a nerve. The explosion delay could also simply be a matter of the creature deliberating whether or not it really wants to die, heh.
I can imagine at least two possible benefits of exploding:
- Disperse eggs. As for why they target humans before exploding? Maybe injured people and human remains are particularly good environments for their eggs to incubate.
- Root out the enemy. Creepers are (eu)social animals which send out "infiltrators" to track down other social predators (humans) and follow them to their dens. By detonating in a crowded camp at night, they stand a better chance of taking out multiple threats at once when they're most vulnerable, or at least severely ruining their day.
A more boring answer is that explosion doesn't necessarily have to be an evolutionary advantageous trait; it could simply be that Creepers reproduce well enough that it hasn't really mattered up to now. But considering their size and probable nutrient requirements (presumably on par with a human), this seems less likely.