Have (got) to, along with its contractions hafta and gotta, is called a Periphrastic Modal Idiom.
Periphrastic means 'using a phrase consisting of several words (instead of an inflection)'.
Modal refers to modal auxiliary verbs, which all have several types of meaning.
In particular, all modals have at least two senses, the Deontic sense and the Epistemic sense.
Since modal auxiliaries are defective verbs (they lack verbal forms, like gerunds and participles),
there are many constructions they can't be used in. No past tense for must, for instance:
- You must be at your desk by 8 am tomorrow. ~ This must be what they do.
- *You musted be at your desk by 8 am in those days ~ *This musted be what they did.
Instead, one uses a periphrastic modal, which does not have these limitations:
- You had to be at your desk by 8 am in those days ~ This had to be what they did.
It's a bit unusual to use have (got) to in the epistemic sense, but it's quite possible
- This has (got) to/This must be the biggest pile of burlap bags in the world.
- After working all day, you must/have (got) to be hungry.
Modals falute a bit higher than their paraphrases, so they are sometimes felt as more formal.