Pain upon entry

I’m newer to sex and probably have had it about a dozen times or so...whenever my bf first puts his dick in me it hurts for a few seconds and then the pain goes away. If we have sex two times in one night this doesn’t happen the second round of sex. Why does this happen?