A horse bred and trained for taking part in racing is termed a racehorse, while a car made for taking part in racing is called a racing car. Could anyone figure out any reason for this apparent inconsistency in compound formation?
Why people say ‘a racehorse’ and ‘a racing car’?
For the same reason that they might say "a racing horse" and "a racecar"!
"Racecar" and "racehorse" are just compound words that are used as nouns.
Dictionary definition of "racecar": https://www.dictionary.com/browse/racecar
Admittedly "racing horse" is not so idiomatic but is occasionally used and would be understood.
race car = a car which can be used in races
racing car = a car which is currently involved in a race (or, at least, which is currently used in races, even if it happens to be temporarily parked in a garage)
Of course, the context is the one which dictates the correct form.
Same explanation remains valid for horses (replacing "garage" with "stable", of course).