Not sure where you're from but in Australia it's "baby of (mothers name)" until you provide information and register their name on a birth certificate. If you gave this information but don't remember, surely you can call the hospital and ask them to check? Xx
Pretty sure when register them for a birth certificate is when their name is final, including the last name
You should be able to amend the birth certificate either way! I’m in Indiana, US. Vital records sent me the form in the mail and gave the information we provided when she was born and had spaces for amending/fixing any errors! If you’re in the US call your local vital records. They can help you!
Just call your paediatrician and they’ll be able to explain the process of changing the baby’s last name