I know a little bit about the history of ancient rome and its decline and eventual fall about 300-400 bc and then I dont know much about history after that. But I also know that during the middle ages the Holy Roman Empire existed around germany. Are they the same at all? Please explain.
The history of the "Imperial Authority" of the Roman successor states is a rather rich, if complicated, field. As always when dealing with the time period, it is important to remember that there still was very much a Roman Empire still existent. The Easter Roman (Byzantine) Empire was still a stable state throughout the period (mostly).
Anyway, to answer your question on a very basic level the you would have to say "Not related at all". The HRE was a completely distinct polity from the Roman Empire in the West. However, and this is where it gets tricky, the HRE derived its authority from an argument that it was, in fact, the successor of Rome. In modern thinking this is sort of a silly notion, after all, the HRE didn't begin until (depending on definitions) Charlemange was crowned Emperor of the Romans
Basically, it comes down to the fact that in middle ages authority was though of as being transferred from ruler to ruler in an unbroken line, so called "translatio imperii". The idea that there could be a period of no legitimate ruler, in the eyes of the law, was out of the question. In this way, even after most of the government functions of the Roman Empire failed in CE 475, there was still a vague idea that the Eastern Emperor was technically the authority. I say technically because, glad-handing aside, it turned out to be really difficult to make the Goths acknowledge said authority. Nevertheless, the new regimes in Western Europe still desired the authority of the emperor, several wanting the ERE to name them Emperor in the west, and respected the authority of some Roman magistrates (basically only the Bishop of Rome).
In any event, around the year 800 the bishop of Rome, the pope, who I mentioned earlier, was having a lot of trouble with the Lombards who had invaded Northern Italy previously. Since the ERE was not much help the pope made a deal with Charlemange: if he could defeat the Lomards, the pope would crown him "Romanorum Imperator Augustus" (August Emperor of the Romans). Charlemange complied and was crowned as such, passing the title onto his descendants for about 125 years, until there was no good claimant to the title. Since the pope was thought to represent the translatio imperii from Ancient Rome this was all legit.
And why shouldn't the pope have been translatio imperii from the Romans? After all the church took over most of the old civic duties previously prosecuted by Roman Imperial authorities.
Finally, a system developed wherein the Rulers of several small German constituents of the HRE would elect from among them a 'King of the Romans' to be anointed "Holy Roman Emperor" by the Bishop of Rome.