Do the math.
Since the constant in the formula is 5252, when RPM also equals 5252, torque and HP are equal, because HP is a calculation of torque times RPM dvided by the constant.
If the RPM is 5252 and the constant is 5252, what happens?
Put another way, if you divide a number by 5252, and then multiply it by 5252, what happens?
500 ftlbs of torque multiplied by 5252RPM equals 2626000.
2626000 divided by 5252(the constant) equals 500 horsepower.
So yes, if calculated correctly, torque and horsepower will always be equal at 5252 RPM because horsepower is a calculated derivative of torque and RPM in a formula with 5252 as a constant divisor of torque multiplied by RPM.
Spend 25 YEARS of your life with engines on a dyno, and you'll be asked about that and explain it often enough that you'll never forget it. If you test in that range, and print the results, 99 out of 100 customers will ask you: "Why is torque always equal to horsepower at that same RPM?" OR they will say: "That's weird, every engine you've ever dynoed for me always has the torque and horsepower equal (or the torque and horsepower lines on the graph always merge) at 5252 RPM."
Now, neither peak torque/RPM nor peak horsepower/RPM can be stated as always being the point of peak efficiency. There are too many other factors involved. There's the point of highest volumetric efficiency, there's the point of best BSFC (brake specific fuel consumption, or the point where the engine consumes the least amount of fuel per unit of power developed) or a couple of others I won't go into here due to time constraints. There's thermal efficency and friction loss as well.
Theoretically, the peak horspower RPM would be where the engine is most efficient, since it is producing the greatest amount of power in the least amount of time.