Was it to distinguish ourselves? Give everyone a sense of individuality? If so, that may have worked for a time, but now three spaces aren't even enough to give unique names.
The reason for first names are pretty straightforward - identification, individuality, etc.
Middle names are interesting - in many cultures (like in Russia, for example), they use patronymics, which identify the father. So Alexander Vladimirovich literally means "Alexander, son of Vladimir." For a lot of other European countries, middle names were a good way to name a child after a saint. Typically, they would take the order of Given Name-Baptismal/Saint Name-Surname. There are also some claims that middle names were used to avoid being cursed. Some people believed that you couldn't be cursed by witches, etc. if they didn't know your full name. Hence a "secret" middle name for protection. I'm not sure of the validity of that one. In the United States, middle names were quite common by the Civil War, and were typically included in official forms after this time. I'd say it became widely popular by the 18th century.
Like rabidcoral said, Surnames are usually a reflection of occupation or ancestral homes and families.