there are times when
Says that something happens sometimes or occasionally.
Use ことがある with a present tense verb (dictionary form) to say that something happens occasionally, not always and not never. It expresses that there are times when that action occurs. For example, you might say you sometimes forget things: 忘れることがある. This pattern is common in everyday speech and writing, and it's straightforward at N4.
You can also attach it to the past tense verb form, but then the meaning changes to 'have had the experience of doing something'. However, the core meaning here is the present tense use: 'there are times when'. To avoid confusion, focus on the present tense with this meaning. The subject is often 'I' or a general 'people', but it can be anything.
Because it means 'sometimes', it's often used with frequency adverbs like ときどき, but it's not required. The nuance is that the event is not rare but not frequent either. For example, going for a walk after dinner sometimes: 夕食の後に散歩することがある.