This sentence is incorrect according to the traditional rules of formal English grammar. It's incorrect because the subject of the introductory clause ("you") doesn't match the subject of the main sentence ("books"). This mistake is called a "dangling modifier". To correct a dangling modifier, the subject of both should match:
When you go in his office, you see that there are books scattered all around.
However, the great majority of English speakers don't know what dangling modifiers are, or that they are wrong. So it's actually very common to find sentences like these in both spoken and written English.