In Lichess, this sequence is rated as a blunder. However, black can take the pawn afterwards without white being able to prevent it (3.Nf3 Qxe4), so it seems like a good move to me.
Furthermore, if white makes the mistake to move 3.g3, black takes the rook (3.Qxe4+ 4.Qe2 Qxh1).
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"] 1. e4 e5 2. d4 Qh4 3. Nf3
This (Blitz) game of mine caused my confusion.