There's a couple of issues at hand here.
One is that the Romans and the Greeks have common ancestors called the Indo-Europeans. These were a group of people, probably living near the Caspian Sea a few thousand years ago, who spoke a language which is the ancestor of Latin, Greek, and other languages. The gods of the Indo-Europeans were passed on to their descendents in some cases. The names Zeus and Jupiter, for instance, are both derived from an Indo-European deity named "Dyeus Pater."[1] So we can see that part of the reason for similarity is that the Greeks and Romans inherited some of their beliefs from a common source. There is much more to be said about Indo-European religion here.
In addition to that, we must remember that the Romans were in contact with Greeks in southern Italy for hundreds of years before their recorded history. Rome was a major trading city long before the extant Latin literaure, so it stands to reason that there was contact between the two cultures that influenced Roman culture. [2]
And lastly, the common conception that the Romans "copied" the Greek gods is unfair in many respects. Some Roman gods, like Saturn, have no clear parallel in Greek religion. Others, like Mars, have a Greek parallel (Ares), but are completely different. Ares is a god of the cruelty and brutality of war whom the Greeks feared, while Mars is an honorable god whom the Romans admire. [3]
It is true that the Romans adopted the customs of peoples they met around the Mediterranean, such as the Greeks and Etruscans, but to say they copied their gods from the Greeks is unfair and inaccurate.
Sources: