Just a curiosity: after how many years does publications become public (cannot be kept behind a paywall anymore)?
Strictly speaking, the answer to your question is Never. Even after the copyright has expired, there is nothing to prevent a journal from keeping articles behind a paywall. Many journals will make articles open access after a certain amount of time, and after the copyright has expired, other people may freely distribute public domain articles. However, there are some journals that nonetheless have paywalled archives going back to the nineteenth century.
Some journals have in their copyright transfer some text regarding when the article becomes open access.
When that is not the case, I would expect that copyright laws apply, and the articles might become public domain after a certain period defined in law, see e.g.: https://en.wikipedia.org/wiki/List_of_countries%27_copyright_lengths
This is somewhat tangential to the question, but it's becoming increasingly common that governments, universities, and funding agencies require research to be published in an open access journal from the beginning.
Such policies are not retroactive – but paywalls are (very) slowly but surely becoming obsolete.
Unless I grossly misunderstand, no one is entitled to anything right off the bat.
A work might be 'in the public domain', but if I have the only copy I could probably still make money off selling access to it (private museum showcasing a manuscript?) or copies of it. An actual or digital copy could, I suspect, be deemed the property of an individual even if the contents are public domain. It seems likely that the step of providing access or making copies is not guaranteed even if being in the public domain means the public owns them.
Also, the following webpage suggests that the compilation or collection of something could be copyright even if the individual parts are public domain. The example given is a compilation of poetry. Taken as a whole, then, the database/system containing the collected articles wouldn't be public domain and it's hard to imagine how you'd b able to argue that the company in question should provide access/copies for free
Taken as whole, if the definition of public here also conveys the premise of being freely accessible, available, then I'd say it could be as long as never.
It depends on the funder and their rules, but a one year period is typical.
If research is funded by the American NIH, some version of it needs to be accessible within twelve months of the publication date. This can either be achieved by publishing in an Open Access journal or by submitting a preprint version to BioMedCentral. Here is the NIH's Open Access Policy.
The (also American) NSF has adopted a similar policy, as has NASA and the Department of Agriculture. The Department of Energy has a long public access plan that is supposed to provide access to DOE work and data, but I'm not sure how much has been implemented. The Department of Defense mantains the Defense Technical Information Center, which provides access to unclassified DoD-funded research papers and some data sets, again with a 1-year embargo period for non-open access publications.
All of these initiatives seem to flow from a February 2013 memo by John P. Holdren entitled "Increasing Access to the Results of Federally Funded Scientific Research."
Meanwhile, in Canada, the Tri-Agency council (NSERC, CIHR, and SSHRC, which together fund most Canadian research) have adopted a similar open access policy that also requires authors to either publish in open-access venues or deposit the final peer-reviewed manuscript in an appropriate repository, again within 12 months. These rules were effective starting in 2008 for CIHR and May 2015 for NSERC and SSHRC. Like the NIH policy, this also covers things like gene sequences.