Do I have to pay the selected card's cost when it attacks?

No, you do not have to pay the cost of the card you play using Rek'Sai, Swarm Queen's ability.

When you resolve Rek'Sai's "When I attack" ability, you are instructed to "play" the card you chose from the revealed cards. Because the ability does not include the phrase "ignoring its cost," you would normally be required to pay the card's cost. However, in the context of Riftbound, when an ability instructs you to play a card from a zone other than your hand (in this case, from the top of your deck), and does not explicitly state that you must pay its cost, the standard procedure is that the card is played without paying its Energy or Power costs.

If the ability intended for you to pay the cost, it would typically be phrased as "you may pay its cost to play it." Since it simply says "play it," you play the card for free. Note that you must still satisfy any other requirements for playing that card (such as it being a unit to play it at the battlefield), and any mandatory additional costs (like those from keywords or passive abilities) would still apply.