Sulaiman killed Mustafa, because he knew it was the only way he could secure throne to his favorite son, Selim, who had much weaker claim than Mustafa as he was a son of Suleiman's second wife, who was a former Polish slave. It is said that Mustafa was much more capable both in battle and managing affairs of the State, but Suleiman would hear none of that as he was obsessed with his Polish wife and therefore her son. I think the Ottoman empire would have been much better off with Mustafa succeeding Suleiman.