A gerund is a verb used as a noun. 

In English, the gerund is formed by adding -ing to a verb root. It is identical in form to the present participle (ending in -ing) and can behave as a verb within a clause (so that it may be modified by an adverb or have an object), but the clause as a whole (sometimes consisting of only one word, the gerund itself) acts as a noun within the larger sentence. For example: Eating this cake is easy.

In "Eating this cake is easy", "eating this cake", although traditionally known as a phrase, is referred to as a non-finite clause in modern linguistics.  "Eating" is the verb in the clause, while "this cake" is the object of the verb.  "Eating this cake" acts as a noun phrase within the sentence as a whole, though; the subject of the sentence is the non-finite clause, specifically eating.

Other examples of the gerund:
 I like swimming. (direct object)
 Swimming is fun. (subject)

Not all nouns that are identical in form to the present participle are gerunds. The formal distinction is that a gerund is a verbal noun – a noun derived from a verb that retains verb characteristics, that functions simultaneously as a noun and a verb, while other nouns in the form of the present participle (ending in -ing) are deverbal nouns, which function as common nouns, not as verbs at all. Compare:
 I like fencing. (gerund, an activity, could be replaced with "to fence")
 The white fencing adds to the character of the neighborhood. (deverbal, could be replaced with an object such as "bench")

Double nature of the gerund 
As the result of its origin and development, the gerund has nominal and verbal properties. The nominal characteristics of the gerund are as follows:
 The gerund can perform the function of subject, object and predicative:
 Smoking endangers your health. (subject)
 I like making people happy. (object)
 The gerund can be preceded by a preposition:
 I'm tired of arguing.
 Like a noun the gerund can be modified by a noun in the possessive case, a possessive adjective, or an adjective:
 I wonder at John's keeping calm.
 Is there any objection to my seeing her?
 Brisk walking relieves stress.
The verbal characteristics of the gerund include the following:
 The gerund of transitive verbs can take a direct object:
 I've made good progress in speaking Basque.
 The gerund can be modified by an adverb:
 Breathing deeply helps you to calm down.
 The gerund has the distinctions of aspect and voice.
 Having read the book once before makes me more prepared.
 Being deceived can make someone feel angry.

Verb patterns with the gerund 
Verbs that are often followed by a gerund include admit, adore, anticipate, appreciate, avoid, carry on, consider, contemplate, delay, deny, describe, detest, dislike, enjoy, escape, fancy, feel, finish, give, hear, imagine, include, justify, listen to, mention, mind, miss, notice, observe, perceive, postpone, practice, quit, recall, report, resent, resume, risk, see, sense, sleep, stop, suggest, tolerate and watch.
Additionally, prepositions are often followed by a gerund.

For example:
 I will never quit smoking.
 We postponed making any decision.
 After two years of deciding, we finally made a decision.
 We heard whispering.
 They denied having avoided me.
 He talked me into coming to the party.
 They frightened her out of voicing her opinion.

References 

Parts of speech