Why does Sex hurt?

When I have sex it feels like my boyfriend is hitting something? I’m nervous because a lot of things like cervical cancer and such cause pain with sex.. help?