The Galaxy Sword is one of the best weapons you can get in Stardew Valley, and it's actually pretty easy to get your hands on. You will need to have unlocked the Calico Desert before you can get it, so you might want to start working on the Vault Bundle in your Community Center (or purchase the Joja Community Bus Repair for 40,000 gold).
Aside from having unlocked the Desert, you will also need to get a Prismatic Shard. This is a mineral that can be obtained in geodes, found in Iridium nodes, and can be gotten from a few other sources. You can also get them from monster drops from either Serpents, Mummies, Shadow Shamans, or Shadow Brutes in the mine after you have reached the bottom of it. The drop chance is only 0.05 %, so be prepared to kill a lot of monsters before you get it.
Once you have a Prismatic Shard, head to Calico Desert, and go north-east. You will see three pillars there, and what you need to do is to go right to the middle of these three while holding the Prismatic Shard as your active item. This will consume the Prismatic Shard and give you a Galaxy Sword!
You cannot offer more Prismatic Shards to get additional Galaxy Swords, but you can get replacement swords for 50,000g from Marlon in the Adventurer's Guild shop.