Nightmare Moon is one of the villains in My Little Pony: Friendship is Magic, and the main antagonist of the two-part pilot episode "Friendship is Magic" also known as "Mare in the Moon". Before that, she was known as Princess Luna, and is the younger sister of Princess Celestia.
It's unclear if "Nightmare Moon" is an Entity who possessed Luna or not; the show seems to lean that Nightmare Moon is Luna's alternate personality but the comics state that Luna was corrupted during her time on the moon.
Many fans consider her as a top fan favorite villain more than any other villain in the show.
Long ago, Luna and Celestia were both the rulers of Equestria, a land inhabited by ponies. Every morning, Celestia would raise the sun, and every evening, Luna would raise the moon. Together, they kept the balance perfectly. One day, however, Luna grew jealous: the ponies would be awake to enjoy the day and love, admire, and appreciate Celestia's work, but would always sleep through her far more beautiful night. One day, Luna turned on Celestia, saying she should be the only princess in Equestria, and raised the moon before the bitterness in her heart manifested and transformed her into Nightmare Moon.
Celestia did not want to fight Nightmare Moon and told her to lower the moon, but Nightmare Moon said her only royal duty was to destroy Celestia, and shot at her with magic beams, eventually knocking her down. Seeing no other way, Celestia reluctantly used the Elements of Harmony to overpower Nightmare Moon and banish her to the moon, creating the phenomenon known as "the Mare in the Moon" (a unicorn's face imprinted upon the surface of the moon). It is said that in a thousand years, on the longest day of that year, Nightmare Moon will make her return.
Nightmare Moon's return and redemption
Upon reading an ancient legend, Twilight Sparkle realized Nightmare Moon is about to return, however her mentor, Princess Celestia, encouraged her to make friends instead of worrying about the supposed "old pony's tale". Unfortunately, Twilight turned out to be right and Nightmare Moon was released during the Summer Sun Celebration, replacing Celestia who was supposed to attend it. Twilight and her soon-to-be friends chased Nightmare Moon into the forbidden Everfree Forest.
Fortunately, when Twilight heard her new pony friends calling for her, she felt a different spark in her heart; making her realize that the real Elements are not just some stones: they exist in the hearts of her friends. That spark triggered the final element: Magic (also known, of course, as Friendship), and reanimated the shattered Elements, converting them into jewels for the six friends to bear. Using the Elements of Harmony, Twilight activated a spell that struck Nightmare Moon, exorcising the darkness from her and transforming her back into Princess Luna.
Much like archetypal, over-the-top villains, Nightmare Moon is overly confident of herself and dramatically declares that the protagonist is a fool (foal) for thinking she can defeat her, and that "the night will last forever." She is portrayed as vicious and maniacal.
Nightmare currently resides in the Castle of Two Sisters. She does not have a physical body, as she is the shadow of the evil that was removed from Luna when the Elements struck her. She still retains use of magic, and is very aware of those that enter her domain.
Some of this page is derived from the Friendship is Magic Wiki.The original article is at Nightmare_Moon.