Answer by Japanese teacher
Konnichiwa is often used as a greeting to mean “good afternoon”. It was actually once part of a greeting sentence (today is…) but has evolved to its shortened form now to simply say hello.
Ogenki desu ka means “how are you”. You can reply to this greeting by saying “はい、元気(げんき)です hai, genki desu” (I’m fine).
A more polite way of replying would be to say “おかげさまで、元気(げんき)です okagesama de genki desu” (thanks to you, I’m fine). Okagesamade is used to show appreciation or gratitude for the assistance of others that brings about a good outcome.
It is a common reply to Ogenki desu ka and you do not have to take it literally.