Woah, what Beijing did you go to? Did you walk in the backstreets at all? A block outside of the forbidden palace and it the streets are filled with trash and unpainted cinder block one story buildings. Even around Wangfujing I'd consider it dirty and the further outside the center you go the worse it gets.
I may a Tokyo apologist but it is by far a cleaner city than Beijing, it's just busier.