Rodrigo was the name of Roderic, the last Visigothic king of Iberia before the Muslim conquest, and it remained a popular given name among Castilian nobles. The surname could have originated in the 9th century, when patronymic names first appeared, and became common from the 12th century onward.
At first a patronymic was not a fixed surname. A man called Alvaro, son of Rodrigo, was Alvaro Rodriguez, but his own son Juan would be Juan Alvarez, son of Alvaro, not Juan Rodriguez. The name only became a family name when households stopped recomputing it each generation and passed the same ending down unchanged.
In the United States, Rodriguez is the eighth most common surname overall. According to the data on the Hispanic hub on this site, 93.0% of bearers identify as Hispanic or Latino. The Portuguese equivalent is Rodrigues, with -es instead of -ez.