Answer
Do I have to pay to publish open access?
Not necessarily. Fully open access journals usually charge an article processing charge, but many waive it entirely for authors in eligible countries, and diamond journals charge nothing to anyone. In a hybrid journal you can publish at no cost through the subscription route, though the article will not then be open access. Depositing a copy in a repository is free.
Detail
Four routes that cost nothing
A country-based waiver; a diamond journal; the subscription route in a hybrid journal; or a repository deposit. Which is available depends on your affiliation, your funder and your target journal.
What to check first
Whether your institution has an agreement with the publisher, and whether your country appears on that publisher's waiver list. Those two checks resolve most cases.