In the example sentence, the word witnessing is not a gerund, because it is not functioning as a noun. Please note, the present participle (ing) form will be a gerund if works as a noun. Here it is an adjective complimenting the subject “Any person”. In the second sentence “who witnessed the murder” is a relative adjective clause complimenting the object “the man”.
A gerund has nothing to do with relative pronoun.
When two verbs are used together in a sentence and since the subject can take one verb, the second verb is often in the gerund form (-ing /present participle form of the verb) or the infinitive. There are no specific rules concerning which verbs take which form. Like irregular verbs, you will need to learn which form a verb takes.
Interested in Language