mast of ship
桅 centers on the mast of a ship, the tall vertical spar that supports sails.
桅 combines 木 (tree/wood) with 危, which likely contributes the sound and may suggest something tall or precarious, fitting the mast of a ship.
A wooden (木) mast stands tall and looks dangerous (危) when you climb it: 桅 is the mast of a ship.
For ガイ, imagine a guy climbing the mast: guy -> ガイ, and he holds onto the wooden mast for dear life.