one would certainly think that they were at the Jedi temple at the same time and even if Grogu was kept separate from the other students due to being super special (and perhaps wanting to keep him away from Anakin if they feared they were part of a dyad) that R2 being with Obi Wan would have known about Grogu
There was a lot in these seasons about droids and how Din goes from fearing them, to trusting them, to then having to fight one (the Dark Trooper) to then having to trust R2 (or R2 being a sign of Luke being trustworthy).
Obviously in Star Wars in general there is the theory that you can tell if a person is good or evil based on how they treat droids