I like to think that there was an entire MOTU storyline of heroes and battles and civilizations that took place millenia before He-Man walked on the scene. Castle Grayskull and it's weapons and technology (tech suit, weapons rack, turret lasers) are remnants of this forgotten time. Only the Goddess and the Sorceress, and maybe Zodak know of this age and the events which went on then, and the consequences of what can happen if The Power of the Universe falls into the wrong hands. This is what keeps them ever vigilant in their efforts to keep the Power Sword seperated.
I like to think King Grayskull was just appointed The King of Castle Grayskull for his efforts in keeping Eternia safe from evil, not that he created the castle. I think it's much cooler if it's shrouded in mystery.