Hello, is this sentence grammatically correct?

The lecturer explained to us how greenhouse gases come about, and we soon wondered what we could do to forestall disaster.

Your sentence is wordy. Better would be --

After the lecturer explained how greenhouse gasses come about, we wondered what we could do to forestall disaster.

Yes, the sentence you provided is grammatically correct. It is a well-constructed sentence that effectively communicates the intended meaning.

Here's the breakdown of the sentence:

"The lecturer explained to us how greenhouse gases come about" - This part of the sentence describes the lecturer's action of explaining how greenhouse gases are formed or generated.

"and we soon wondered what we could do" - This part expresses that as a result of the lecturer's explanation, the speaker and others present began to wonder or think about what actions they could take.

"to forestall disaster" - This phrase indicates the purpose or objective of their wondering. They are contemplating ways to prevent or avoid a potential disaster.

Overall, the sentence effectively conveys how the information provided by the lecturer led the speaker and others to ponder potential solutions to the issue of greenhouse gases.