Why was Solomon chosen as King instead of one of his brothers? 1 Kings tells us that, when David was elderly and impotent, Adonijah considered himself as heir-apparent and crowned himself, but Nathan the Prophet and Bathsheba approached David:


  She said to him, “My lord, you yourself swore to me your servant by the Lord your God: ‘Solomon your son shall be king after me, and he will sit on my throne.’ But now Adonijah has become king, and you, my lord the king, do not know about it.


Why would David have chosen Solomon, the younger candidate, as a successor?
David chose Solomon as his successor because “the word of the Lord came to [him]” telling him to do so. David, due to his many sins, was unworthy of building God’s temple. God chose Solomon from before his birth as the one who would build the temple and reign over Israel. 

1 Chronicles 22:6-10


  6 Then he called for Solomon his son and charged him to build a house for the Lord, the God of Israel. 7 David said to Solomon, “My son, I had it in my heart to build a house to the name of the Lord my God. 8 But the word of the Lord came to me, saying, ‘You have shed much blood and have waged great wars. You shall not build a house to my name, because you have shed so much blood before me on the earth. 9 Behold, a son shall be born to you who shall be a man of rest. I will give him rest from all his surrounding enemies. For his name shall be Solomon, and I will give peace and quiet to Israel in his days. 10 He shall build a house for my name. He shall be my son, and I will be his father, and I will establish his royal throne in Israel forever.’