Swordfish can be caught when fishing for orange ripples in the Dazzle Beach biome. You will generally want to fish when it is not raining because, while it is raining, orange ripples in Dazzle Beach may spawn Fugu instead of Swordfish.
You can increase your chances of finding a Swordfish by crafting a Miracle Fishing Bait or Even More Miraculous Fishing Bait and then applying it to your Royal Fishing Rod. This allows you to turn white ripples into orange while the Bait is active.
To complete this task, you must catch 5 swordfish. Your reward for doing this will be 20 Scream Canister Tokens, which you can exchange for Star Path rewards such as clothing, furniture, and new Dream Styles for various Villagers.