There are two aspects to this question. First, there is the question of why Turkey is trying to join the EU and why the EU wants Turkey. Second, there is the issue of why Turkey is only in the relatively early stages of joining the EU when it has been trying to join for decades.
As to the first issue, there are at least three main reasons why Turkey and the EU are interested in one another. First, the EU has long been one of the most economically prosperous areas of the world. Turkey naturally wants to be associated with this area more than with poorer areas such as Eastern Europe and the Middle East. Second, Turkey has not been a communist country and therefore it was oriented towards the West during the Cold War. Finally, Turkey is on the outskirts of Europe and is a large country, thus making it an attractive member for the EU.
As to the second issue, the main problems have to do with cultural geography. Turkey has long been seen as part of the Muslim east rather than the Christian west. This is shown, in part, by the problems between Turkey and Greece that have helped to stall Turkish membership. It is also shown by the EU’s concerns that Turkey is not as dedicated to the idea of human rights as the West is.
For these reasons, the EU and Turkey are interested in one another, but Turkey has not yet become a member of the EU.