* Present participle of the verb "have": This is the most common use. It acts as a verb form that describes an ongoing action, like in "He is having a good time."
* Gerund: When "having" acts as a noun, it's a gerund. For example, "Having a good time is important."
* Adjective: In very rare cases, "having" can function as an adjective. For instance, "The having clause in this sentence is confusing."
To determine the correct part of speech, look at the sentence and how "having" is used.