As you’ve been learning throughout our lessons, the Korean language has several politeness levels and therefore there are several ways of saying certain phrases. This applies to the way we thank people.
The most common and formal way to thank someone in Korean is to use the phrase 감사합니다. It can be used any time when you wish to show respect towards the person you’re thanking. For example, towards strangers, towards teachers, in a store, at a restaurant, during a job interview etc.
감사 means “gratitude” and 합니다 means “to do,” so therefore you are literally giving gratitude to the person you are talking to.