Unlocked once you research and build it at Operations level 20, the Scrapyard lets you permanently dismantle a ship you don't need in exchange for resources, blueprints for that same ship type, Ship XP, or ship parts -- and occasionally a shot at materials for the next tier up. Scrapping is irreversible, so double-check you're not about to feed your only usable hull into the furnace before you confirm.
What comes back depends on the ship's type and level and on your own Scrapyard's level -- upgrading the building, and asking your Alliance for a speed-up, both raise the payout and the dismantling speed. A ship also has to actually be scrappable: some hulls are excluded by design, some need a higher Scrapyard level than you currently have, and a ship that's assigned to a Drydock or out in space has to come home first.
Since Update 90, scrapping a maxed Grade 5 ship returns roughly 20% of what you put into it, plus about 2.5% toward a Grade 6 ship of matching rarity. G5 scrapping runs on longer timers than G4 by design, with payouts tuned against your Cost Efficiencies and that ship's percentage cost so the reward tracks your progression instead of staying fixed. If you just want hangar space back without waiting on the scrapping queue, the Demolish button removes a ship from your hangar instantly -- no reward, no timer, useful for junk you were never going to scrap for value anyway. A handful of ships can't be demolished at all, including the Realta, the U.S.S. Vengeance, and every Grade 7 hull.