The origin of the Swords of Greyskull have slightly varied of over the years. As in the original stories the sword of power was split into two, one was dark and the other was good. It would be later that the two swords were forged together to allow access into Castle Greyskull, the original legend goes that the Council of Elders hid all their secrets, power and knowledge of the universe within the walls of the castle. But to prevent those who would use the powers for evil to get into the castle they fashioned a key as well as a conduit source for the powers of Greyskull. This was the Sword of Power, the sword's power could only be used by a hero worthy of the power. But to be extra careful until the day comes the power sword was split into two fragments. One of which was an evil sorcerer warrior named Skeletor found the sword of power of the evil half and the other was later given to Prince Adam, since then He-man and Skeletor fought for control of both swords.
It was later when He-man crashed his wind raider at the edge of the jungle, Skeletor took the opportunity to steal He-Man's half of the sword and put them together and left a fake one by He-Man. He-Man had to be sure that the castle was fine, and when he arrived at the castle he found the the sorceress was missing. Skeletor had already gotten into the castle but did not find the power as he was still searching. He-Man defeated Skeletor, and the castle was safe again. It would be from this point from the 80's comic line that Skeletor would try to break down the walls of Castle Greyskull in order to get to the secrets that laid within.
In 2002 comics the style of the sword changed for the Sword of Greyskull was changed with a more mechanical look. This was to allow a shape and design difference between prince Adam and He-man. The origins of the sword were also changed as well. The sword was not split into two halves like the old comics. This time it was just a sword used by its original owner, King Greyskull and after his victory of Hordak he died which giving his mystical power to his companions who would become the Council of Elders, the sword only became magical after the death of King Greyskull.
The Sword of Power still remains as a key to get into Castle Greyskull but rather a stone slot which the sword is put into. A command is issued to the castle using the sword or any sort of replica of the sword to command the drawbridge to open. It was in the Story arc Dark Reflections when an alternate universe Man-At-Arms, used a device which replicated the look of He-Man's sword and commanded the draw bridge to open. It was at this same time Skeletor came to realize such entry could be made in the future.
The She-Ra, Power Sword was introduced in the cartoon and series opening episodes of She-Ra: Princess of Power. Her sword was the same as He-Man's but with a stone in the center of it. Though in the 80's story line she did not live in Eternia as she was taken to another dimension called Etheria where the planet was ruled by the Horde. She later joined the rebellion to fight the Horde of the world. Unlike her twin brother's sword, She-Ra only says for the Honor of Greyskull to be able to use this power. Very little is described on the origin of this sword, only that the twins were prophesied to wield the power and the second sword was meant for Adora.
The 2002 and Master of the Universe classic's toy line suggest that the Sword of Greyskull was cloned during the birth of Prince Adam and Princess Adora, but since the sword of protection was not as strong as the Sword of Power, a magical stone of protection was embedded into the hilt to give Adora additional powers. The opportunity never came to give Adora the sword because she was stolen as a baby and was raised by the disembodied spirit of Hordak.
The Sword of Power does not have much in the way of powers, its made of a very durable material, which has been hinted at being made of Eternium which is one of the strongest substances on Eternia, though it becomes as durable as a regular sword when He-Man becomes prince Adam. The sword acts as a magical lightning rod for the mystical powers that come from Castle Greyskull, the sword itself when Adam becomes He-Man that the sword is near indestructible and has survived against the rubbing of tectonic plates, as well as the constant stabbing into mountains or the very earth itself. This allows He-man to cut through any material using the impervious durability of the sword and his own strength. Outside of the durability it has been shown in many issues as a key to get inside Castle Greyskull, with a command "By the Power of Greyskull, I command the drawbridge to open..." that the gates to the castle would begin to open. This was apparent in Dark Reflections story arc that it did not have to be He-Man to have the sword to open the gate as and alternate reality Man-At-Arms opened the gate with a replica of the sword.
The Sword of Protection, this sword is used by She-Ra it's powers itself has the same ability as He-Mans, Sword of Power. Though it is a cloned copy it has shown many feats of durability. in the cartoon and in the 80's comic canon that the sword has the ability to shape shift into what ever She-Ra commands it into; few examples would be a helmet, lasso, or shield. Another ability given by the sword is allow cross dimensional communication or magical communication from either the Sorceress of Eternia, or by light hope of the crystal castle. Though often debated as the better sword of the two.