Well, they didn't really understand what the sun and moon were, or how they got there. So they just did the same thing they did with everything they couldn't understand or control - they started to believe that since they couldn't understand/control it, nobody but a god could. So they started to worship it in the hopes the god would be pleased and control things in their favour.