See Princess Luna.
Nightmare Moon, formerly known as Princess Luna, is a villain. In addition to Luna raising and setting the moon, Nightmare Moon is a villain who wants the night to last forever, eternal. Nightmare Moons heart is a heartbroken heart full of evil. Whose dream is to rule over Equestria without Princess Celestia and the other Princesses and Princes. The Elements of Harmony can only stop this terrifying villain, and has to be banished to the moon for a millennium (1,000 years). However in 1,000 years time, it is the Summersun Celebration. Nightmare Moon escapes (with the help of stars) and returns to cause disaster. This means Princess Celestia had to rise both the sun and moon whilst Princess Luna was banished until a millennium went by.