There's two different things going on here, both of which use the word to, which is probably what's confusing you.
The rule your teacher taught you applies to infinitives, in the context of sentences where there are two verbs, like
I like to run.
The verb following to is in the present tense, as is expected. In this case, to is known as a "particle," which is basically a word that doesn't fit into nice grammatical categories, but has some meaning.
I like to running.
Is not correct.
However, what's happening here is that to is a preposition connected to the adverb forward, which is modifying looking.
You look forward to nouns. These sentences are all acceptable:
I look forward to my wedding.
I'm looking forward to the weekend.
I was looking forward to this weekend, but I got sick.
So in this case, you have to use a gerund, the noun form of a verb following forward to. In English, the gerund is identical to the present progressive, so you get sentences like
I look forward to seeing you.
I look forward to meeting you.
I'm looking forward to dogsledding this winter.
Each of these sentences are acceptable, and use a gerund (verbal noun). You can't use other forms of the verb after the preposition to, you can't say:
I'm looking forward to see you.
I'm looking forward to saw you.
Whereas afraid to do something describes the feeling of fear (or uncertainty) about something you are on the point of doing:
She was afraid to say what she really meant,
afraid of doing something talks in much more general terms of this fear that applies to any time or situation:
Some old people are afraid of walking alone at night in the dark.
So, in the situation of feeling fear about possibility of missing a train, it would be
I hurried to the station. I was afraid to miss my train.
The source.
Best Answer
Is correct. Many students were told by their teacher to not put -ing after to. But, to in ..look forward to.. is not an infinitive marker. "Look forward to" is a prepositional phrase and "to" is a preposition here. A preposition needs a direct object. A direct object can be a noun or a noun form of verb (gerund).