"Get" in used in a very large number of phrasal verbs and expression, certainly over 100. These just have to be learned as you encounter them.
"Gotta" is the way "got to" can sound when pronounced. It is never written this way, except in the most informal cases. As a learner, you should always spell it as "got to".