Here's the breakdown:
* Horse racing context: In horse racing, a horse that is "streets ahead" is significantly ahead of the competition, often by a large margin. The term "streets" refers to the distance between the horse and its rivals, suggesting a vast gap in the lead.
* Metaphorical extension: Over time, this phrase transitioned from its literal meaning in horse racing to a more metaphorical usage. It began to be used to describe anything that is far superior to its rivals, whether it's a product, a person, or an idea.
* Popularization: The idiom gained further popularity throughout the 20th century and is now commonly used in various contexts.
Therefore, while the exact origin is unclear, it's highly likely that the idiom "streets ahead" arose from the world of horse racing and its description of a horse significantly leading the pack.