You cannot target creatures without line of effect
The issue here is if the creature is on the surface, or under the surface, that is, if there is a layer of ground covering it entirely, or not.
If the creature is on the surface
This is what you depict, 0 feet underground. Here the situation is easy: contrary to what you say, the creature is not remaining underground. There is no ground between it and the others.
It can normally attack all of them, and likewise, they can normally attack it, if they have reach or ranged attacks that can reach it. Assuming they all have 5 feet reach, green can attack it with melee strikes, red can attack it with melee strikes if they have a reach weapon, and all can attack it with ranged attacks. You might want to give it and the others some level of cover for earth that may be partially in the way.
If the creature would be under the surface
This is not what you have depicted, but imagine the creaure would be 5 feet down. The red and green would be still within its reach. To understand if the creature can attack them, we have to look at the rules for targeting and cover, because an attack targets the thing that is attacked. The rule for the Strike action (p. 471 Core Rules) says:
You attack with a weapon you're wielding or with an unarmed attack, targeting one creature within your reach (for a melee attack)
The Cover rules (p. 477 Core Rules) say:
If a creature is entirely behind a wall or the like, you don't have line of effect and typically can't target it at all.
It does not matter if the creature has reach to the others on the surface: they are "entirely behind a wall or the like", so it cannot target them with its attacks. That it has a burrow speed does not change this. Burrow does not allow you to attack through walls, it only allows you to "dig your way through dirt, sand, or a similar loose material at a rate up to your burrow Speed."
It could use its burrow speed to move to the surface and attack, at which point the other creatures could hit it back with Ready actions, or they could try and hit it with Attacks of Opportunity, if it tries to burrow back down.
It really does not matter if the creature can pinpoint them with tremorsense or scent while underground in this case.