So you're not having an issue with Safari, you're having an issue with your Apple ID; with the Apple ID that the iPhone is associated with, or with your Apple ID and password if the iPhone is associated with your Apple ID.
Is this a new iPhone, or a new-to-you iPhone? Because if it's the latter and you didn't go through the setup procedure, the iPhone can be associated with the previous owner.
If you did go through the iPhone setup procedure and did enter your Apple ID and password when this iPhone was set up, it would seem your Apple ID or password is incorrect. If so, click or tap on the following blue-text links:
If you forgot your Apple ID password - Apple Support
If you forgot your Apple ID - Apple Support
How to use account recovery when you can’t reset your Apple ID password - Apple Support
Contact Apple for help with Apple ID account security - Apple Support