Why doesn't 1.fxe4 Nf6 work for black in this puzzle? I was solving puzzles and I failed this one.
The correct answer was fxe4 fxe4 Bxh5+.
Why can the knight not just move to f6 and be safe there?

fxe4 Nf6 exd5 fxd5 is in my opinion more preferable for black.

 [Title "1...Nf6?"]
 [fen "rnbqk2r/ppp3pp/3b4/3p1p1n/3Pp3/1P2PPP1/P1P1B2P/RNBQK1NR w KQkq - 0 1"]
Because after Nf6, e5 is a double attack on the d6 bishop and the f6 knight.

The puzzle aside, given that black's dropping the piece anyway, may as well go for something practical, like Nxg3, hxg3, Bxg3+... and take 2 pawns for the piece, with some positional compensation as the king will be misplaced, but objectively white should of course be easily winning.

 [Title "Puzzle"]
 [fen "rnbqk2r/ppp3pp/3b4/3p1p1n/3Pp3/1P2PPP1/P1P1B2P/RNBQK1NR w KQkq - 0 1"]

 1.fxe4 Nf6 (1...fxe4 2.Bxh5+) (1...Nxg3 2.hxg3 Bxg3+) 2.e5