A common statement among racing enthusiasts is that the first race between cars probably happened the day the second car was built. Before we can look at the racing history, we need to look at car history as a starting point.
As early as 1678 there are report of self propelled vehicles. Early attempts using massive steam powered devices that required rails to travel are the ancestors of today's trains. Early vehicles with two, three, or four wheels were produced with steam powered drive, as well as experiments with coal dust and gunpowder driven motors. The manufacturers of these vehicles began making long distance publicity drives, to show the reliability and practicality of their machines. Steam cars came across the ocean to America as well. In 1878 the state of Wisconsin offered a $10,000 prize to the winner of a 200 mile race across the state (of the seven entries only two started the race, one broke down part way, leaving a winner by attrition, with an average of 6 miles per hour).
Just before 1900 the Otto cycle engine made petroleum (gasoline) power a viable option. Companies like Daimler began building these engines that are mechanically very similar to what comes in a gas driven car today. The gasoline power plant made it to america in 1893, strapped to a horse-buggy driving test runs in Massachusetts. Henry Ford built his first 'quadricycle' in 1896. Ford knew that he had to prove his worth against other manufacturers, and chose to do so in competition, driving the quadricycle to Ford's first race victory in a 'straight-line sweepstakes' (a drag race in modern terms).
Ford became the breakout of the American scene, with the famed Model T beginning its production in 1908. Due to the efficiency of the building process, 15 million model Ts would be built over the next three decades. Hiring the speedsters of the day, bicycle racers, Ford began putting larger and more powerful engines onto their vehicles, while reducing their size, earning a land speed record of the day in 1904 by exceeding 97mph. Oldsmobile, Cadillac, and Dodge also built gasoline vehicles in this period.
Whereas american car makers focused on production and sales, the Europeans built their vehicles with quality and impression in mind. Early Daimlers starting in 1899 were more comfortable then the american counterparts, with hand built, customized bodies and luxury in mind. Rolls Royce built their first Ghost in 1906, another machine built in low-number high quality batches. It is considered to be the smoothest running car of this early generation.