What function does it have?

As a subject of the sentence

If the gerund is used as the subject of the sentence, it will be at the front of the sentence.

 

After verbs where you indicate what you think

 

After sensory verbs

 

Other verbs (unfortunately, you have to learn this one by heart)

 

After certain expressions

 

After prepositions (voorzetsels)