Well, let's see.
Does 2 g4 develop a piece? No.
Does 2 g4 control the centre? No.
Does 2 g4 improve the safety of your king? No.
Therefore, 2 g4 is not a good move. Also, 2...d5 seems like a very strong counter, adhering to the rule of countering a flank attack with a centre attack.
To be fair the same exact thing could be said and has been said by me about the Sicilian Defense 1.c5
1...c5 prevents 2 d4 so does help control the centre.
But 2. c3 forever cements white’s control of the center
Interestingly, although the king's indian attack is not a bad line against some black defences and there are other decent lines with e4 and g3, the eccentric 1. e4 e5 2. g3?! is inferior (if far less so than 2. g4??). The reason is the same move 2. ... d5, which provides black with the sort of advantage white might hope for with a good line. The leakiness of white's kingside is visible with this poorly timed second move as it is with 2. g4??