Shalom Everyone!
Here I go again trying to explain concepts which are bigger than I am. Realize that I am only speaking from the perspective of a Jew who only really began studying Tanach eight years ago but I hope by now I have a grasp of the subject matter.
Why didn't King David become Mashiach?Well I don't think that Hashem considered him worthy of that, nor were the Jewish people prepared, and it was not the right time. Of course each of those issues which I listed could have been but weren't.
As I said in my first answer, King David lived a very difficult life. He was so righteous that we cannot even compare ourselves to him, yet the Sages have explained to us that even King David failed at one of the tests which he was given. And what is even more amazing is that the test he was given was at King Davids own request. From this we learn that we should never ask Hashem for a test, lest he give us one tailor made for our weakness, and we fail that test.
King David felt so secure in his righteousness and his cleaving to Hashem that he asked him for a test. And Hashem sent Bathsheba into his life, to tempt him, and he should take her with the appearance of impropriety. I have written in the Torah section many years ago how the Sages explain how King David did not truly sin, yet the appearance of the sin is a stain on his record.
I have also written on JTF before that virtually every great character in our Torah has a weakness, and or a failing. None of our Forefathers are perfect in all traits, although they all are giants in their good traits. I just posted in the Torah section about how this Shabbats Parasha recounts Moses failure to precisely obey the word of Hashem.
Hashem deals with the Jewish people, and the world, with a trait called 'Middah Keneged Middah", which means 'Measure for Measure' or also 'trait for trait'. This is the source of all justice, that one must repay the other for any damages done. This is also similar to the concept of 'Karma' in some ways, that what you do to others will ultimately be done to you.
King David was an awesome leader and could have been Moshiach, Im pretty sure, but so could have Moses been the Moshiach, and he could have entered the land, but it was not to be.
Remember that Hashem, through his awesome and powerful name, 'Havaya' encompasses all of time and space, it means "He was, He is, He will be" and what should be the intention in mind when thinking of this name is that Hashem is not limited by time nor space. Time is only a concern to this reality we live in, and thus we cannot comprehend how free-will fits in with Hashems divine plan.
Hashem will send Moshiach in his appointed time. Through a combination of scenarios that we cannot foretell the redeemer will reveal himself. The traits of the Moshiach must be right, the people must be ready to receive him, and it must be the appointed time...
King David was not permitted to build the Beit Mikdash {Holy Temple} due to having waged too many wars and having 'blood on his hands'.
Here is the answer Rabbi Moshe Goldman from Chabad gives:
http://www.chabad.org/library/article_cdo/aid/625408/jewish/Was-King-David-wrong-for-waging-so-many-battles.htmQuestion:
I've heard it said that King David was denied the opportunity to build the Holy Temple because he had "blood on his hands" from the many wars he waged. If this is the case, why do we hold David in such high esteem? Why was he chosen to be the progenitor of the Moshiach?
Answer:
You are correct. King David told his son Solomon:
"But the word of G‑d was upon me, saying: 'You have shed much blood, and you have waged great wars; you shall not build a house in My Name because you have shed much blood to the ground before Me. Behold a son will be born to you. He will be a man of peace, and I shall give him peace from all his enemies around about . . . He shall build a House in My Name.'" (I Chronicles 22:8-10.)
We always need to concern ourselves with one question only: "What does G‑d want from me right here, right now?" For David, the answer was to go to war to protect his nation against the various military threats that they faced. The fact that later on he was not allowed to build the Temple is no indication that his warfare was a black mark on his record. It was simply incompatible with the peaceful nature of the Temple.
A simple analogy: You are walking to a black tie dinner, and you pass by a muddy swamp. You notice someone sinking in the mucky water, screaming for help, so you jump in and save him. The guy you rescued thanks you profusely and goes on his way—but you won't really feel comfortable continuing on to the black tie dinner in your muddy, dripping suit. Chances are that security will escort you out if you do decide to make an appearance.
So does that mean that you now regret saving the drowning man?