As a luxury brand, BMW has typically been up towards the top of the best resale value list for more than a decade now. Problem is, that you bought the wrong model BMW at the wrong time. Especially if you bought new in 2005. Look at what has happened since then, record high gas prices, horrible economy, shift to more fuel efficeint vehicles, etc.
Also, as vehicles have become more complicated and are now packed with more electronics, less people want to take on the responsibility of owning one outside of the warranty period due to the cost of potential repairs. Especially, highly equipped 5 and 7 series vehicles with V8 engines.
Now, if you would have bought another BMW model in 2005, like say the e46 M3, you would have enjoyed MUCH better resale value than the X5 and it would have had similar performance to the more expensive Carrera.