iwould like to know what are gerunds in grammar and the rules to study them.

Gerunds are verbs ending in “-ing” that are used as nouns. They cannot be main verbs. They may be both objects or subjects. They refer to the act of whatever verb is specified, like the infinitive, but unlike the infinitive, they can be prepositional objects. They are not to be confused with the present participle, which also ends in “-ing.” The present participle will form progressive tenses or be used as an adjective; it will not be used as a noun.

Running is my favorite activity. - As a subject
I like writing. - As an object
He had to choose between writing and painting. - As prepositional objects

They retain their ability to be modified by adverbs and to take direct objects of their own.

Running swiftly helps the heart. - As a subject with an adverb, “swiftly.”
Writing letters will ease your loneliness. - As a subject with a direct object, “letters.”