He is seeing his own reflection in your window and trying to run that invader off. The males are so bad about that. Can't do much about the car window but you could try taping a piece of paper or cardboard to the house window to show him that there's a window there.
My daughter works at an office that has those clerestory windows and a crow like to killed himself trying to attack his reflection. They had to get animal control to come get him because he was bashing so hard into the window. I told them to tape a piece of paper up there but they were too busy to do that.
Annie