Well, the particle "wa" is written "ha" (は) in Japanese. I think these set phrases started out as sentences starting with "こんにちは" -- "as for this day..." and "こんばんは" -- "as for this evening..." Over time they got shortened to the simple (and somewhat nonsensical) forms they have today. Sort of how like us english speakers started out saying "Good morning to you" and now just say "'mornin'!"
Justin