This is difficult, bordering on impossible. You would probably need the Red Scare to be much much worse for Hoover to enter Presidential politics. So perhaps the key is the cliched President Henry Wallace scenario. Yes, I am aware that the Wallace Presidency probably wouldn't be as bad as some of his detractors suggest. But then again, a President John Edgar Hoover is in and of itself fantastically unlikely. So, Wallace becomes President, and behaves as per the cliche, again I'm not convinced Wallace would actually do this, but bear with me. The result is that circa 1947 or so, the Red Scare reaches heights the panic never did historically. Subsequently, the Republicans decide the hand their nomination to the number one anticommunist crusader in the country, Director Hoover of the FBI. Of course even here there's the name problem. Herbert Hoover is well within living memory at this point, and that's problematic for making the Director of the FBI President of the United States.
Again, I'm not sure that I entirely buy the notion that President Henry Wallace=Worse Red Scare in the 1940's. But I can't imagine any other circumstance that might have led to the Presidency of J. Edgar Hoover.