Some time ago a substance used as a food preservative which is believed by some to be carcinogenic was allowed to be used. If in a case like that it is found at the time that it actually is so, is someone legally responsible for allowing it to be used, or at least not warning people about its consequences? I suppose this is something similar to the use of cigarettes, how does this work in these cases?
There is a saying that you can't sue city hall: that is applicable here. Governments enjoy sovereign immunity, and cannot be sued for their errors of judgment unless they specifically allow it. Safety regulations are an example of a situation where the government hold all of the power and shoulders none of the responsibility. If a government forbids sale or use of a substance on some grounds (could be safety, could be economic impact, could be something about preventing the moral decay of society), and the grounds later turns to be false, you cannot sue the government because of lost business opportunities.
Generally speaking, that which is not prohibited is allowed, so there would have to be an affirmative duty for the government to prevent all forms of harm. If there were such a legal duty, there is a miniscule legal foundation for suing the government for shirking its duty. That is not a completely hypothetical possibility, in that the state of Washington imposes a constitutional duty on the legislature to provide public education, and the Supreme Court has done things to enforce this duty (the contempt of court fines are up in the realm of $80 million).
Since there is no jurisdiction that imposes a duty on the government to absolutely prevent all harm, you won't be able to sue the government if they fail to outlaw a thing that is eventually proven to harm someone.