On the third day, he pulled a .45-caliber handgun and fatally shot one of the painters, then calmly lit a cigar and waited for police to arrive, authorities said Thursday.
"I shot the (expletive)," defendant Stephen Boyd allegedly told police before his arrest Wednesday along the Grand Central Parkway near Shea Stadium in Queens.
Boyd, 44, was ordered held without bail Thursday after his arraignment in the death of James Gaviglia, said Patrick Clark, a spokesman for District Attorney Richard A. Brown.
Gaviglia, 38, and three other workers had been sent to repaint the overpass. They arrived Monday to find Boyd and his belongings beneath the bridge, and they worked around him for two days, police said.
Clark said the workers gave Boyd a dollar bill on Monday and a sandwich on Tuesday.
But the homeless man opened fire after he was forced to move his shelter so the painters could finish the job Wednesday, police said.
Gaviglia, a Queens father of three, was struck three times in the stomach and died a short time later at a hospital.
Boyd was arrested at the scene, confessed to the crime and directed officers to the murder weapon, Clark said.
"My anger took hold of me," Boyd allegedly told police. "I said to myself, 'I will not be treated like this.'"
Boyd was charged with second-degree murder and criminal possession of a weapon, and his next court date was set for Dec. 7. The judge, at the request of defense attorney Kevin O'Donnell, ordered the defendant to undergo a psychological exam.
"I don't think this guy knows what's going on," O'Donnell said after meeting twice with his client. "He had this calm about him that was kind of eerie. It was like talking to half a person."
O'Donnell said Boyd had worked as a security guard in Reno, Nev., and was homeless the last four years.