Sami Chokri says he was hurt by the tone of Sheeran's lawyers' emails after he noticed similarities between his song Oh Why and Sheeran's Shape Of You.
"I feel like I've been robbed by someone I respect, or respected," he told the court.
"This is years of a cloud over my head. All I heard and read was emails belittling me and my questions."
He continued: "All I wanted to do was ask for an explanation. If I'd had one we wouldn't have had to go through with this rubbish."
He later called the trial "the most horrible few weeks of my life".
Mr Chokri, who performs under the name Sami Switch, says the "oh I, oh I, oh I," hook on Shape Of You is "strikingly similar" to the chorus of his song, which was released two years earlier.
In a witness statement, he said he first became aware of the alleged plagiarism in 2017.
"I was a passenger in my girlfriend's car and Shape Of You came on the radio," he wrote. "She and I were both shocked to hear the similarities.
Mr Chokri later put out a Facebook post saying, "Anyone else think Ed Sheeran's new song Shape Of You chorus sounds familiar lol?"
"I had lots of responses," he said, including one from Sheeran's friend Jamal Edwards featuring the "shifty eyes" emoji - which was later deleted.
"I thought maybe he had played a part in showing [my song] to Ed," Mr Chokri told the court. "I had no reason to ever consider it coming to circumstances like these."
Before his death last month, Mr Edwards gave a written statement in which he denied playing Oh Why to Sheeran.
"Even if I was sent a copy, I did not share it with Ed," he wrote.
"I respect what Jamal says," Mr Chokri responded in court, "but I also believe that Jamal would share music with Ed Sheeran."
Sheeran and his co-writers Johnny McDaid and Steve Mac have all denied copying Oh Why.
Sheeran 'treats others fairly'
Last week, Sheeran told the court that the contested element of Shape of You was "very short", and the relevant parts of both songs were "entirely commonplace".
He added: "Even so, if I had heard Oh Why at the time and had referenced it, I would have taken steps to clear it.
"I have been as scrupulous as I possibly can and have even given credits to people who I believe may have been no more than a mere influence for a songwriting element. This is because I want to treat other songwriters fairly."
Giving evidence on Monday, Mr Chokri disputed the star's claim, saying: "I believe Ed Sheeran heard it, that's my truth."
Asked if he was accusing the star of lying under oath, he responded: "I'm not sure if he lied or he doesn't remember."
In his witness statement, Mr Chokri said he had written Oh Why in June 2014 at a time when he was "truly in pain".
"I remember specifically that I was drinking some wine that day whilst we were writing and recording," he wrote. "I was saying, 'Why do I keep putting myself back in this place?'
"I recall singing to Ross [O'Donoghue, his co-writer], 'Oh why, Oh why, Oh why?' and Ross saying something along the lines of, 'That's It! Let's work on that'.
"The song really resonated because it was a little bit different to anything else that I had made."
Mr Chokri later tried to get Sheeran to listen to the song "as I was inspired by his success and stardom and his endorsement would be a significant boost".
To increase his chances, he sent an EP that included Oh Why to several people in Sheeran's circle, including producer Adam Coltman, musician Jake Roche and Jamal Edwards.
Giving evidence, Mr Chokri said he was certain that one of them would have played it to the star - but "I can't tell you exactly which because I don't know".
Ian Mill QC, representing Sheeran, suggested that Oh Why was itself inspired by Ed Sheeran's cover of the Johnny Cash song The Wayfaring Stranger.
"I doubt it," replied Mr Chokri. "That was a life-changing day for me. I wasn't thinking about Ed Sheeran, I was thinking about staying alive."
He acknowledged being a fan of Mr Sheeran's work, and The Wayfaring Stranger in particular.
"I definitely appreciated his work," he said, "but I've got a bitter taste in my mouth since he stole a part of my song."
Mr Chokri and Mr O'Donoghue first accused Sheeran and his copying their song in 2018.
The trio denied the claims and launched legal proceedings in May 2018, asking the High Court to declare they had not infringed any copyright.
Several months later, Mr Chokri and Mr O'Donoghue issued their own claim for "copyright infringement, damages and an account of profits in relation to the alleged infringement".
In court, Sheeran's lawyer noted that Mr Chokri had not registered Oh Why with music rights body the PRS until April 2017 - three months after Shape Of You was released.
"The fact you weren't registered is indicative of the fact you weren't earning money" from the song, he said.
"My main focus... was to get my name out there," replied Mr Chokri. "I didn't think about money at all."
Mr Mill suggested the real reason for registering the song was so Mr Chokri could pursue his copyright claim.
"I was advised that would be the next step," he told the court, but "didn't know that signing up to PRS was for that purpose".
An estimated £20m in royalty payments has been frozen since that point.
The trial continues.