The main factor is here undoubtedly Christianity. The Ancient Greeks may have distinguished themselves from the eastern Persians, but they did not align themselves any more with the barbarian tribes in most of Europe at the time. In fact, they at least appreciated the civilisation of the Achaemenid Persians. Other factors, most notably the Roman Empire and it successors the Byzantine and Holy Roman Empires contributed to uniting Europeans as a single entity.
The partitioning of the world in this sense started after the growth of Christianity really, and properly after the rise of Islam. In all fairness the "West" is really synonymous with the European Christian world, which happens to lie mainly in the west of the Old World. The "East" refers to the non-Christian, predominantly Muslim, Hindu, and Chinese/Oriental regions. Africa usually isn't included in this, due to the lesser role the continent played in world religion and politics for the most part, and never really posed a threat to European religion or culture (unlike e.g. the Arabs or Turks).
During the Middle Ages, the fierce wars between Christian European nations and the "East" in the form of religious Crusades in the Levant, and notably the Mongol invasions of much of Eurasia except Central and Western Europe only increased the view of Westerners and Easterners mutually as strange foreigners, and often enemies. In essence, a combination of religion, conquest (imperial rule), culture, and ethnicity led to increasing separatism between the "West" and the "East". It has however interesting to note that these factors unified European/Western nations rather more than they did the Asian nations, arguably for obvious geographic and historical reasons.
Now, historically the majority of Christians were based in Europe and specifically controlled by Rome (the Catholic church) -- very much towards the West of the Old World when considered as a whole. The colonisation and Christianisation of the Americas by the Spanish, Portuguese, French, and English, only helped solidify this geographic barrier. Sure, Australia/New Zealand sort of broke it, but they're still considered "Western" nations because of their religious and cultural heritage. Hence, the term is largely cultural and socio-political these days, rather than geographic.