。
He stole on a sudden impulse.
Literal
He [topic-は] sudden-impulse [with-で] stealing [object-を] did.
出来心 (できごころ, 'sudden impulse, passing fancy') is the specific word for an unpremeditated urge — often used to explain petty theft. 盗み (ぬすみ, 'theft, stealing') is the noun form of 盗む. で marks the cause/reason. The sentence is likely from a crime report or courtroom context, explaining that the theft wasn't premeditated.