In the picture of this guy at the link, he does look middle eastern. He may not have been doing anything nefarious, but the law enforcement guys may have been looking for terror suspects and profiled him. Don't expect Spanish law to mimic US law when it comes to civil rights. Besides, the whole country is full of leftists.
Again, the source article says he "fought" with the police. When he decided to tangle with these plainclothes police, that puts the "not-so-smart-a-thing-to-do-in-a-foreign-country" burden on the back of the American. The policía were probably just doing their jobs, which to some people, especially in the US lately, is problematic enough to denounce them.