안녕하세요. = Hello. / Hi. / How are you? / Good afternoon. / Good evening. / etc...
안녕+하세요 = 안녕하세요.
안녕 = well-being, peace, health
하세요 = you do, do you?, please do
안녕하세요 is the most common way of greeting someone in Korean, and 안녕하세요 is in 존댓말 [jondaetmal], polite/formal language. When someone greets you with 안녕하세요, you can simply greet the person back with 안녕하세요.
A: 안녕하세요. [annyeong-haseyo] = Hello.
B: 안녕하세요. [annyeong-haseyo] = Hi.
감사합니다. = Thank you.
감사 + 합니다 = 감사합니다.
감사 = appreciation, thankfulness, gratitude
합니다 = I do, I am doing
감사합니다 is the most commonly used formal way of saying “Thank you.” 감사 means “gratitude” and 합니다 means “I do” or “I am doing” in 존댓말, polite/formal language, so together it means “Thank you.” You can use this expression, 감사합니다, whenever you want to say “Thank you.” in English.