Short Answer: Jesus was not asking the man to do something He had never done; rather, He was asking the man to follow in His footsteps. He was asking the man to lay down his life in love for others ...just like Jesus.
While I appreciate the typical Christian answer of "Jesus was addressing his personal idol" I lean toward another explanation based on the text.
Why not just say it was "the man's personal idol"?
One of the issues I have with the typical answer is that it doesn't seem to me to mesh with Jesus' flow of thought (evidenced by the context). Jesus' initial response to the man is not "you are in idolatry"; His initial response is to remind him in general of the requirements of the Law. Also, Jesus' explanation of the encounter to the disciples (after the fact) is a generic commentary on how hard it is for rich people in general to enter the kingdom. If the typical answer is correct, why doesn't Jesus go on to explain the dangers of idolatry, rather than the dangers of being rich? It is difficult to explain Jesus' statement in verses 23-24 if "being rich" is not really an issue at all. What we need to do is trace Jesus' flow of thought.
"What good thing shall I do that I may obtain eternal life?" (v.16)
Let's start with the heart of the matter. The rich man is asking how he can earn salvation by his good works. Anyone with any familiarity with New Testament theology should immediately see red flags going off in their mind upon reading this. The rich man was very confused; he would never be able to obtain eternal life by doing good things. The Law was given to shut up everyone under condemnation -- the only way to avoid that would be to keep the entire Law, which no one could do.
Meet the Law (v.17-19)
Jesus knew the purpose of the Law, and he knew the rich man's error. Thus, He replies that if the rich man desires to "obtain eternal life" by his good works, he must keep the Law -- all of it. After He lists a few sample commandments, He then summarizes the entire Law by saying "You shall love your neighbor as yourself." (cf. Gal. 5:14, Rom. 13:8-10, etc.)
"All these things I have kept." (v.20)
The rich man replies by essentially saying "check." He thinks he has kept the Law! He couldn't be more wrong, for the essence of the Law is to love one's neighbor, and everyone fails at that. No one keeps the whole Law -- no one is even able to. The rich man has misunderstood the Law, thinking it to be a few simple external codes to conform to... he is missing the heart of the Law, and failing to recognize his own failure to keep the Law; his own failure to love his neighbor the way God desires.
As noted, all of these commandments in the Law are summed up in saying "love your neighbor". Love, as Jesus defines it, involves laying down your life for your friends (John 15:13). The man's "neighbors", as Jesus defines it, includes everybody (Luke 10:29ff). Jesus even taught that "you are to be perfect" (or "complete") in your love for others!
If you truly wish to be perfect . . . (v.21-22)
To recap, Jesus' use of the term "perfect" here refers to a "perfect love for others", which would be the fulfillment of the Law, which is what is required in order to be found blameless in your good works before God. Thus to "be perfect" is to love perfectly. Love, remember, is laying down your life for others, and those "others" includes everybody. Thus, "be perfect" = "lay down your own life for everyone else".
Did Jesus do this? Ya.
Did Jesus want His disciples to follow His example in this? Yes. (cf. Luke 9:23)
Now, a point of clarification is in order here. When Jesus tells this rich man who "owned much property" to go sell his possessions, give the money to the poor, and follow Him, He did not mean "sell the clothes you're wearing -- including your undergarments, ...and your belt, ...and your walking stick, ...and give away every last cent you have in your pocket. The man had an abundance, which he was storing up for himself, while his neighbors next to him were impoverished. Jesus was instructing him to repent, serve those in need rather than serving himself, and then come follow Him. He is not asking the rich man to do anything different than He had already done (and would continue to do).
It is hard for a rich man (v.22-24)
At this point Jesus comments on the difficulty rich people have in entering the Kingdom. Why? It's pretty simple really: because those who spend their lives accruing wealth for themselves are generally very reluctant to give it all away to others and follow Jesus instead. There is a sharp contrast between the generic "rich man's" selfishness and Jesus' demand to lay down your self to serve others in love. Jesus had already said: You can either serve God or wealth, but not both; these two paths in life are in stark contrast (Matt. 6:24). A rich man said one time: "You don't get rich by giving your money away!" Indeed you do not. No, you get rich by keeping your money; by serving yourself, hording resources that could be used to help those in need, and closing your heart to the impoverished and desperate.
Summary
The rich man wanted to keep his possessions, not use them to help those in need. He wanted to earn his way into heaven by good deeds, but he did not want to lay down his life for his neighbor in love. Jesus confronted this fundamental issue, and presented the man with a choice. The man chose to reject Jesus' offer. Jesus was not asking the man to do something He had never done; rather, He was asking the man to follow in His footsteps.
But whoever has the world’s goods, and sees his brother in need and closes his heart against him, how does the love of God abide in him? -1 John 3:17