〜ことがある
Sometimes happens to…machine translation
FormationVerb dictionary form / ない-form + ことがある
Verb dictionary form + ことがある says that something OCCASIONALLY happens: バスが遅れることがある (the bus is sometimes late). It often goes with ときどき or たまに. With the ない-form — 〜ないことがある — it means "sometimes doesn't…": 朝ご飯を食べないことがある.
Don't confuse it with 〜たことがある from N5: た-form + ことがある talks about EXPERIENCE you've had (日本へ行ったことがある — I have been to Japan), while dictionary form + ことがある talks about something that still happens now and then. Only the verb form before it differs, yet the meaning changes completely — exams love this point.
Note that this pattern isn't used for things that happen frequently; for "often" you use the adverb よく with an ordinary sentence: よく遅れます.
Examples
私はたまに学校に遅れることがあります。
I'm occasionally late for school.
このバスは時間どおりに来ないことがある。
This bus sometimes doesn't arrive on time.
日本人でも漢字を間違えることがあります。
Even Japanese people sometimes get kanji wrong.