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.
There is no specific reason behind the composition of such compound words.
English language is weird and unreasonable mostly. There's no dead-end rule, even the basic ones (like i before e except after c, use of an only before vowels etc) are sometimes not applicable in some situations.
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).