Sorta worried

My boyfriend was going to finger me but once he started rubbing my clit it hurt so he stopped by a little later I wanted him to try again and it hurt but went away. So what happened and why’d it hurt to begin with? Any answer helps