Valmiki Ramayana Bala Kanda Sarga 70 Shloka 37
Original Shlokaसपत्न्या तु गरस्तस्यै दत्तो गर्भजिघांसया। सह तेन गरेणैव जात: स सगरोऽभवत्।।1.70.37।।
1 source checked for this shloka
सपत्न्या by her rival queen, तस्यै for her, गर्भजिघांसया with the intention of destroying embryo, गर: poison, दत्त: was given, तेन by that, गरेण सह एव with poison itself, जात: was born, स: that, सगर: sagara, अभवत् became.
Since poison was given to her by her rival queen with the intention of destroying the embryo, the son was born with poison and so came to be known as Sagara.