As someone already mentioned, torque is force that can be measured on a dyno. Horsepower is a calculated value that represents work over time (power).
The formula for SAE horsepower is torque (measured in lb/ft) X RPM /5252
(torque times RPM divided by 5,252)
This formula illustrates how two engines with the same peak torque can have different horsepower ratings. It depends on what rpm that peak horsepower is achieved at. The torque curve influences which at which RPM we achieve maximum horsepower.
I hope this simplified explanation helps.