It blocks the only semi-open file for White and shields Black's weakness, d6.
There is no reason behind the move. In the Najdorf, h7 is rarely the issue. The weakness in the Najdorf is the e6-pawn.
Direct attacks on the king in the Najdorf are more rare than in other openings, like the Dragon.
h7-attacks tend to occur more in defenses where Black does not advance his Kingside pawns, like the Colle, French, Nimzo-Indian, etc.
White has NUMEROUS options that are all better than 6.Bd3. They include:
A) 6.Bg5
B) 6.Be3
C) 6.Be2
D) 6.Bc4
E) 6.f4
F) 6.g3
G) 6.h3
H) 6.Nb3
I) 6.Rg1
All 9 of these moves are theoretically better than 6.Bd3.
Remember, theoretical and statistical are not the same thing, so do not start spouting that one of the 9 responses I gave is worse than 6.Bd3 statistically.
This keeps coming up in my games and I don't know why Stockfish shows Be3 and not Bd3. Bd3 zeros in on the black king (h7 square). It protects the center e4 pawn. It also gives white a chance to castle. Be3 on the other hand does the opposite. Unless black castles long, white has to make one more move to castle.