I'm planning to publish my first paper, and while choosing a journal, I noticed that the journals can be open access or not. As far as I understand it, open-access journals can be read for free (i.e. without paying subscription fees) by anyone. Does it imply that I can be published in such a journal for free? Can free-for-authors journals be non-open access?
Most journals require some fees for authors. For most open access journals the fees can be quite high. Journals have expenses and the author generally shares those. But open access journals don't give the publisher a revenue stream after publication, though the expenses may not be reduced. Thus more of the burden falls on the author.
Some open access publishers have an alternate revenue stream (sponsors, advertising,...) so that authors don't need to "contribute" to the cost of publishing and maintaining web sites and such.
But, in reality, most established academics, realizing this, will find a way so that the charges don't fall on them personally. Including publication charges in a grant is typical. Some universities will absorb fees for faculty, perhaps.
I don't know how receptive open access publishers are to claims of poverty, but ordinary publishers will often forgive page charges in an author indicates they would need to pay them personally.
But, each publication has its own rules. In fact, for some publications sponsored by professional organizations, the general membership fees partly cover some of the expenses.
But, in general, expect some fees for publication - especially in open access publications. As a student, you could ask your university to cover fees. If they refuse, then ask the journal to forgive the fees. If you worked with a professor or in an established research group, they may have funds to cover publication expenses.
Forgiveness of fees is more likely to be successful for non-open-access, I'd guess.
The usual pattern is that authors pay for open access publication. The money comes from their institution's funds. If it's not open access, you should not be paying.
"Green" and "Diamond" open access are usually free. "Green" open access does not provide ready access to the article. "Diamond" is rarely available, in my experience.