Gerunds function as subjects or objects. Where does the phrase learning together sit in our example sentence, in a subject position or in an object position? If neither, does it modify a noun? If so, it functions adjectivally, as a participle:
Ex: Critics worried that boys and girls learning together would have bad consequences.
Note, what could happen if boys and girls were placed in the same class? Whatever could happen is what the critics are worried about.
Does that help?