Everywhere in the world, the sun was admired. Even though everyone loved it, no one loved the sun as much as the sun himself. It had declared this many times to his fellow companions.
While majority adored the sun, the moon thought him quite rude. He never listened to anything other people had to say. For a conversation, he went to go speak to the sun's goddess, Solar Deity.
As the moon met the goddess, his expectations were not only met, but exceeded! He expected her to be just like the sun, boastful, rude, and other negative traits. They met more and more often to discuss thoughts on their mind, which was usually about the stars and planets. The moon was extra careful to not let slip his feelings on the sun.
As the moon visited the goddess every sunrise, he once showed up and saw the goddess disappointed. Apparently, she had heard the sun gloat about himself being the best. She had then confronted him saying to not be so egoistic. They then proceeded to a heated argument.
When Solar Deity finished explaining this to the moon, they both thought of the same thing at the same time. This thought was that moon could take a power, giving people the urge to sleep.
As the sun then realizes what Solar Deity had done, he was stunned. He wanted to get as far away from the moon as possible. Moon also had the urge to get away from the sun (as he already had). After much controversy, they both agreed they would have different parts of the day. So that's why the sun comes out during the day, and the moon comes out during the night.