She denied seeing him yesterday.
vs
She denied having seen him yesterday.
What is the difference in meaning between these two sentences?
The first example tells that she said yesterday that it was not true that she saw him that day.
The second tells that she said yesterday that it was not true that she saw him before the moment of speaking.
For further explanations, it is useful to look at textbooks.
Simple gerund The simple gerund can refer to the same time as that of the verb in the main clause:
I hate arguing with you. (arguing refers to the same time as hate: I hate when we argue.) Tom suggested going back to our tents. (going refers to the same time as suggested: Tom suggested that we should go back to our tents.)
The simple gerund can also refer to a time before that of the verb in the main clause:
I don't remember saying anything like that. (saying refers to a time before don't remember: I don't remember that I said anything like that.) She regretted not studying harder when she was at school. (not studying refers to a time before regretted: She regretted that she hadn't studied harder when he was at school.)
Perfect gerund The perfect gerund refers to a time before that of the verb in the main clause. However, it is only used if the time of the action expressed by the gerund is not obvious from the context:
He denied being married. (the simple gerund being refers to the same time as denied: He denied that he was married.)
He denied having been married. (the perfect gerund having been refers to a time before denied: He denied that he had been married.)
If it is clear that an earlier time is meant, we use the simple gerund:
He denied stealing the car. (He denied that he had stolen the car.)
" She denied seeing him" to me means she denied having an appointment or a meeting with him, whereas "denied having seen him" means she didn't see him, as in see with your eyes.