It's the phonetic spelling of how we would pronounce "got ya", because 'you' in many colloquial cases is 'ya' (got ya = I got you)
'Gotcha' can be a few different things, like playing with a small baby, and grabbing onto them 'gotcha!' or grabbing a body part, like 'gotcha by the nose!'
Between older children and adults, the single phrase "gotcha" is the same as "I tricked you/I fooled you/you believed my joke."
(not a teacher, just a language lover)
Student or Learner