Either because of the Lord's love to him, as the name signifies; or because the Lord commanded him to do so.
Related Commentaries of 2 Samuel 12:25
2 Samuel 12:25
25 And he sent by the hand of Nathan the prophet; and he called his name Jedidiah,d because of the LORD.