If you are unable to cast the targeted card (there are no legal targets for the spell, for example), nothing happens when the ability resolves, and the card remains in its owner's graveyard.

Artwork
Loading artwork…
Wrexial, the Risen Deep
New Capenna Commander · #359 · EN
Nonfoil—Foil—
Card rules
Islandwalk, swampwalk (This creature can't be blocked as long as defending player controls an Island or a Swamp.)
Whenever Wrexial deals combat damage to a player, you may cast target instant or sorcery card from that player's graveyard without paying its mana cost. If that spell would be put into a graveyard, exile it instead.
5/8
Mythic · Illustrated by Eric Deschamps
Format legality
Commander Legal
Duel Legal
Legacy Legal
Modern Legal
Oathbreaker Legal
Penny Legal
PreDH Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Pioneer Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Tlr Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
If you cast a card "without paying its mana cost," you can't pay any alternative costs. On the other hand, if the card has additional costs (such as kicker or multikicker), you may pay those.
If you cast the targeted card and it would be put into its owner's graveyard from the stack for any reason (either because it resolves or because it's countered), that card is exiled instead.
If you want to cast the targeted card, you cast it as part of the resolution of Wrexial's triggered ability. Timing restrictions based on the card's type are ignored. Other restrictions are not (such as "Cast [this card] only during your end step").