The origin of hot dogs actually dates back to over five hundred years in the past. It is believed that hotdogs were made in Germany first and it was definitely not named hotdog back then! The sausage was actually named by a butcher in Frankfurt, Germany as "dachshund sausage", after his pet dachshund. Perhaps the shape of the dachshund, which is a small dog with a long and slender body, caused the butcher to see the resemblance between his sausages and his dog. Thus the name "dachshund sausage" came to existence. How the name changed from dachshund sausage to hotdog is another, highly controversial story.
Douglas B. Smith mentioned in his book that the credit of the name should go to the cartoonist T.A. Dorgan of the "New York Journal". According to the story that Smith wrote in his book "Ever Wonder Why", T.A. Dorgan was enjoying a baseball match back in 1901, when he heard vendors yelling to sell their "hot dachshund sausages". The situation drew the attention of Dorgan and being a cartoonist by profession, he made a cartoon sketch of the whole situation but being unsure about the actual spelling of the term "dachshund", he gave it the name of "hotdog". This is the most popular theory about the origin of the name hotdog.
It is to be noted that the above theory regarding the origin of the hotdog is not proven to be the absolute. Also, the various details may vary widely with each website or book that you would come across. For example, the year is found to be 1906 in place of 1901 in some cases, while some claim that it was not a baseball match but a polo game. Others claim that it was neither a baseball match, nor was it a polo game; rather it was a six-day bicycle race. Which of these facts are true or if all of them are false, is something that is hard to tell accurately now, but what it does suggest is that the story is doubtful. There are other theories also, which stem from the fact that the term hotdog was in use even before TAD or Dorgan used it to depict his cartoon.