If you cast a spell with multiple X mana symbols in its cost, the first ability triggers only once.

Artwork
Loading artwork…
Elementalist's Palette
Secrets of Strixhaven Commander · #346 · EN
Nonfoil—Foil—
Card rules
Whenever you cast a spell with X in its mana cost, put two charge counters on this artifact.
: Add one mana of any color.
: Add
for each charge counter on this artifact. Spend this mana only on costs that contain X.
Rare · Illustrated by Alessandra Pisano
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
The mana added by the last ability can be used only to pay costs with at least one X, but it can be used to pay for any part of that cost, not just the X. That X could be in a spell's total cost, an ability's activation cost, or a cost you're asked to pay as a spell or ability resolves.
The mana added by the last ability doesn't all have to spent on the same cost.