Because we confess to things, and we use nouns for things:
He confessed to theft, simony, prostitution and perjury.
He confessed to a secret admiration for his opponent.
Edwards confessed to espionage for the KGB.
Gerunds can be used as nouns, and so we can use gerunds here too.
(Confess can also take a noun directly as an object, but this is more often done of qualities rather than acts, so we can both "confess cowardice" and "confess to cowardice", but we'd more likely "confess to running away" rather than ?"confess running away").
For an example of a verb being used after to, we can look at:
I want to eat something.
*I want to eating something.
I want to be eating something.
I want some food.
Here the meaning of the verb want is such that it can take an object directly (the last example), or use to to link it to a verb describing an act (the other two correct examples), but not to an object (the incorrect example).
It comes down to a difference in the meaning of the two words.