I don't understand how that move is a good move, much less the best move according to this chess.com analysis.
The picture already answers the question:
If you play any other move but ...Bh8, for example ...d6, White will answer g4 and trap your knight. Some exchanges can be thrown in before he can capture (dxe5, Qxd1 etc.), but ultimately, there's no escape.
...Bh8 by itself is indeed not a desirable move (moves a developed piece again, to a square with less influence), but here it's a tactical necessity to save that knight (which is more valuable than losing a move or two) by vacating an escape square.
Since White is behind in development, Black can actually afford to give that tempo without major damage (+0.31, says the computer).