The Bible tells us in this text that David gave him the name Solomon. But like Joseph at the birth of Jesus, David also does what God had told him to do. God had chosen that name. David tells Solomon this when Solomon is an adult (see 1 Chronicles 22:9)
24 Then David comforted his wife, Bathsheba, and went in to her and lay with her, and she bore a son, and he called his name Solomon. And the LORD loved him