Is it possible to install Xcode 9 on a mid 2009 MacBook Pro 17 inches? I'm looking for a MacBook to develop iOS apps and I've found this mid 2009 17 inch MacBook Pro at a reasonable price.

Does Xcode 9 run on it?
Not officially, no.

Xcode 9 will require macOS Sierra 10.12.4 to run. Unfortunately, the Mid-2009 17" MacBook Pro can only run the latest version of OS X El Capitan 10.11.6.

However, unofficially the Mid-2009 17" MacBook Pro can run macOS Sierra by virtue of the macOS Sierra Patcher Tool. 

If this is something you want to consider doing, make sure you read all the information on the macOS Sierra Patcher Tool page as it contains important information you should weigh up before proceeding. If it was me I would not proceed without a full backup ready so you could recover your system if all goes bad.

NOTE: I have not seen Xcode 9 actually installed on any unsupported Mac, so cannot confirm that it would work on one which has macOS Sierra installed as a result of the macOS Sierra Patcher Tool.