Why was Adonijah killed by Solomon's orders?
To understand the dynamics a bit, we need to understand that typically succession of a king went by birth order. "Sons were born to David in Hebron: His firstborn was Amnon by Ahinoam the Jezreelitess; his second, Chileab, by Abigail the widow of Nabal the Carmelite; the third, Absalom the son of Maacah, the daughter of Talmai, king of Geshur; the fourth, Adonijah the son of Haggith; the fifth, Shephatiah the son of Abital; and the sixth, Ithream, by David's wife Eglah. These were born to David in Hebron" (II Samuel 3:1-5). Solomon was the fourth son born to Bathsheba, not counting the first son who was killed because of David and Bathsheba's sin. In other words, Solomon was quite far down on the list of succession.
Amnon was killed by Absalom after he raped his half-sister Tamar. We don't know what happened to Chileab (also known as Daniel in I Chronicles 3:1) but it is likely he was no longer living by the time of I Kings 1. Absalom was killed after trying to stage a coup against his father. Thus, Adonijah was thought to be the next in line.
When his father was close to death, Adonijah decided it was time for him to be named king (I Kings 1:5). He staged a parade and got the support of David's general (Joab) and Abiathar, the priest. This was all done without David's knowledge or blessing. We are even told why Adonijah did this: "And his father had not rebuked him at any time by saying, "Why have you done so?" He was also very good-looking. His mother had borne him after Absalom" (I Kings 1:6). In other words, Adonijah was a spoiled brat who had always got whatever he wanted.
But word reached David about Adonijah's plan. David wanted Solomon to succeed him. The fear was that if Adonijah became king in the eyes of the people both David and Solomon would be killed (I Kings 1:11-21). David calls for Nathan, the prophet, Zadok the priest, and Benaiah of the guards. Solomon was anointed to be king and this was proclaimed in Jerusalem and throughout Israel, before Adonijah could get back from his king-making party (I Kings 1:32-40).
Adonijah feared that he would be killed so he goes into the tabernacle and clings to the altar to claim protection. However, Solomon declares that as long as Adonijah behaves himself, he would live (I Kings 1:51-52).
Later David dies. Adonijah asks to marry David's last wife, Abishag (I Kings 2:19-21). This might seem like a strange but minor request until you realize there was a long-standing tradition. The wives of the prior king become the responsibility of the next king. By asking to marry a wife of David, Adonijah was attempting to strengthen his claim for the throne. That is why, "King Solomon answered and said to his mother, "And why are you asking Abishag the Shunammite for Adonijah? Ask for him also the kingdom -- for he is my older brother -- even for him, for Abiathar the priest, and for Joab the son of Zeruiah!" " (I Kings 2:22). In other words, if you are going to give Abishag to Adonijah, why don't you just go all the way and ask me to give up my kingdom to him and the other conspirators.
Because Adonijah did not keep his end of the bargain but persisted in trying to take the throne, Solomon had him put to death (I Kings 2:23-25).