thank you in advance!
Why engines recomond g6 in this position?

This position is roughly equal and ...g6 is the top engine move (at least at my depth), but it isn't the only move. Other moves like ...Bc6 or ...Qd7 are also good moves for black.
When a move recommendation like ...g6 appears, then I sometimes like to just follow some top engine lines in different variations and just focus on the element I'm looking for and try to identify patterns to reason out why that move was played.
In this case, the ...g6 move weakens the castled King, so I figured their must be a reason to justify this and my thinking was either creating a retreat square for the Bishop to fianchetto itself on g7, or for the King to move up to g7. Both of my ideas were incorrect - although ...Kg7 was closer as this did happen in a few variations.
After glancing at a few engine lines, it looks like ...g6 is played to get the King to h7. Presumably, the ...Kh7 move immediately is vulnerable to potential tactics along the b1-h7 diagonal and especially with the Queen on that same diagonal too (think long-term something like Bd3 and black loses their Queen by the pin). It looks like the black King wants to tuck itself safely near the corner, so that the Queen and dark-squared Bishop have more freedom to relocate elsewhere, rather than playing defense of their King. It looks like ...g6 and later ...Kh7 keeps the King fairly safe. That is probably the "plan" with the ...g6 move.
Black has the bishop's pair, that means that Bf6 is unopposed. Thus black should put pawns on light squares g6-h5 to activate Bf6 to the maximum. So ...g6 prepares ...h5.

Black has the bishop's pair, that means that Bf6 is unopposed. Thus black should put pawns on light squares g6-h5 to activate Bf6 to the maximum. So ...g6 prepares ...h5.
Ooh, I wasn't even thinking about the Bishop Pair in this situation (although I should have!), but it makes perfect sense.

yes, g6 and h5 makes sense.
but Black's long term weakness in the position is his defense of his isolated d pawn. in essence, Black's Queen is pinned to the defense of the d pawn. While whites Queen has mobility.
another idea is g6 supporting h5 stops white from playing Bg4 covering the d7 square.
@9
"white has problems with his d pawn as well" ++ Yes, black can attack pawn d4 twice with bishop and queen. White can then defend d4 twice with queen and knight. To do so, the knight has to be on a light square, say e2. There black's light square bishop can capture the knight and thus win pawn d4. The resulting opposite colored bishop ending has drawing chances despite a pawn down.
"Black's Queen is pinned to the defense of the d pawn."
++ No not really. The black queen can give up the defense of pawn d5 to attack the white pawn d4. If white captures black's d5 pawn and white captures white's d4 pawn, then the position is wide open for black's bishop's pair to run supreme.