Doubt in king gambit olening

https://www.chess.com/lessons/learn-the-openings you can see all openings variations and counters here

3.Bc4 or 3.Nf3 are better then 3.d4 in my opinion. After 3.Bc4 Qh4 you play 4.Kf1 and develop with Nf3 and d4. Of course try to castle and develop your pieces. And keep h4 in mind if your opponent ever plays ...g5.

Don't play d4 there. You want Nf3 lots of cool lines, I'll show you a few:
Opponent immediately blunders and doesn't know how to defend his pawn
Or here, where our pieces co-ordinate beautifully (if they block with the queen there are some more fascinating lines and sacrifices, but this was simpler to show)
Or this line... I mean the list goes on and on, this is just where your opp plays the mainline with g5, too. If you like memorizing theory, the KG is one for you. If you don't, though, stop playing immediately. Because you can lose in a heartbeat if you don't know how to handle it.