I once told a Japanese person that she was mistaken using わ after こんにち in her emails. She said that she’s been using it for the last 40 odd years without knowing any different. I didn’t know the reason, but I was told in one of my early Japanese classes to use は and not わ. Anyway, this Japanese lady believed what I’d told her but believed that わ was equally acceptable.
While fiddling on my keitai in Japanese, I came to the realisation that there is kanji for konnichiwa: 今日は！
こん＋にち＋は and everything started to make more sense. Note that normally 今日 is read as きょう (kyou).
After realising this, I told a different Japanese friend about my revelation and he put everything into context for me by completing the こんにちは puzzle.
Greetings (あいさつ） Japanese people used to use were:
今日はどちらへ行きますか – Where are you going?
ちょっと （出かけています） – I’m just out for a bit
So, over time the initial greeting became shortened:
今日はどちらへ？ ＞ 今日は？ ＞ こんにちは
So the は in こんにちは is は and not わ because it’s actually a particle from the sentence 今日はどちらへ行きますか!