Take the following examples:
The painting of the picture is interesting
Painting the picture is interesting
A gerund is something like a verb. Notice that the second example has "painting" as a gerund because it is similar to a verb. Its object it: "the picture".
The word "painting" in the first example however is acting as a noun followed by "of".
Telling him the truth (Here it is a gerun because it has an object)
Thinking of the matter (here it is a participle because it is acting like a noun)