used after the past tense of a verb to indicate that someone has the experience of having done something (have done/have been).
日本に行ったことがある。
I've been to Japan.
以前この店に来たことがある。
I've been to this shop before.
子供のころ、よく川で遊んだことがある。
When I was a child I used to play in the river.
to indicate that something happens occasionally or from time to time (it sometimes happens).
ときどき遅刻することがある。
Sometimes I am late.
この薬は人によって副作用が出ることがある。
This medicine may sometimes cause side effects in some people.
冬は寒くて出かけたくないことがある。
There are times in winter when I don't want to go out.