Seeing as how Gates and his driver really did break into the house in broad daylight, by his own admission, it's obviously not ridiculous for the cop to be there. It's not as if the cop is clairvoyant and magically knows that Gates is actually the resident and was breaking into his own place. Investigating this sort of thing is what police officers are supposed to do. But I guess Harvard professors are supposed to be immune from law enforcement.
Of course the cops should have responded to the call and investigated the matter.I've got no problem with the fact that the officer asked for his ID.
Apparently, Gates showed his ID and the cop was satisfied that Gates hadn't committed any crime. At that point, Gates started acting like a complete tool, yelling nasty things at the cops. Which is not illegal.
In response, if the cops had been off-duty, maybe they could have roughed him up a little. (I wouldn't really approve of that; but it'd be less bad if they were off-duty than on-duty.) When they are in uniform, however, they are not supposed to use force without legal justification. That seems to be what they did by making an arrest on a BS charge.
Gates was a tool, and if he hadn't been, he probably wouldn't have been arrested. But that's a little like saying that a woman wouldn't have been harassed if she hadn't dressed so provocatively. Both sides acted wrongly, or at least imprudently. But only one side acted contrary to the law.