Aaron McKenzie, 26, allegedly broke into Kelly Fauvrelle’s bedroom as she slept and stabbed her 21 times, causing catastrophic injuries.
Their son Riley was delivered by Caesarean section but died in hospital four days later.
At the time of the killings, Royal Mail worker Ms Fauvrelle, 26, had been 33 weeks pregnant and “moving on” with her life, the Old Bailey was told.
Prosecutor Duncan Penny QC told jurors: “The Crown’s case is that this was a vicious and deliberate killing – perhaps in due course you will conclude the cowardly response of a man desperately jealous about the fact that the mother of his child yet to be born had moved on and now wanted very little to do with him.”
In early 2019, Ms Fauvrelle’s relationship with McKenzie, with whom she shared an interest in motorbikes, had ended, jurors heard.
In February, McKenzie messaged that he was feeling “not needed, not wanted, unimportant and lost” as he appealed to her.
Ms Fauvrelle told him he needed professional help, saying: “Until u get the fact I don’t want to be with you anymore…I will no longer speak or see you unless is about the baby” (sic).
Last March, Ms Fauvrelle allegedly told his mother that the relationship was “toxic”, but she would not deny him access to their child.
Mr Penny said that about 3.15am on June 29 last year, an intruder broke into Ms Fauvrelle’s family home in Thornton Heath, south London, through patio doors.
He said: “That intruder proceeded to launch a vicious and a cowardly attack upon her, inflicting a total of 21 stab wounds with a knife.
“In the process, the intruder murdered not only Kelly Fauvrelle, but through his attack upon Kelly he killed Riley, the unborn child she was carrying.”
In the wake of the attack, McKenzie pretended to have nothing to do with it, the court heard.
He went to the hospital where medical staff were trying to save the life of his child, “posing as a victim”, Mr Penny said.
The defendant allegedly lied to police and did not tell them that he had spent over an hour before the killing accessing and reading his ex-partner’s emails.
Mr Penny said McKenzie continued to deceive police, hospital staff and Ms Fauvrelle’s family until he was arrested and “confessed”.
McKenzie, from Peckham, south-east London, denies the murder of Ms Fauvrelle, the manslaughter of baby Riley and possessing a knife.