If we are our brains, and our brains know how they work, this means that this information is stored somewhere in the brain, like the inferior temporal cortex is the part of the brain that recognizes numbers. Where is knowledge of how the brain works stored?
I think that you focus this question in the wrong way. There is no place in the brain where the "instructions" are stored. The brain don't need "know" how it works to work. The way in that the brain works is an emergence from the structure and the biological dynamics. All of this is based in all the layers of biological computation (genetic/molecular/cellular/organ/...) and the interaction with the environment. So there is no a particular place, if you want to discover how the brain works you must to study all the system.
Actually we can built iterative process that show complex behaviors but the laws that control this behavior is implicit and is not stored in the result. See The game of the life.
This type of knowledge is known as "semantic memory"; a type of "declarative memory". We don't yet know where semantic memory is stored in the brain, although there is evidence that hippocampal and/or parahippocampal structures are required to store semantic memory.
The fine details of exactly what a "memory" is in terms of neurobiology, where and how it is stored, and how it is retrieved is an area of neuroscience that is currently under very active research. However, our knowledge is very rudimentary at present.
Generally speaking, Kato's answer is good. I'd like to add that there is a fascinating way in which the brain understands other brains - also called mindreading or theory of mind (the basis for empathy). This process is heavily reliant on the sensory modalities. When you put yourself in someone else's shoes, your brain attempts to imagine their experiences (including their emotions). This consists of a reactivation of various aspects of your own previous sensory experiences, in an attempt to simulate their state of mind. The brain does this all the time, but especially when it is trying to understand other brains. Of course, this isn't the only mechanism at work - more logical modes of thought probably also play a role. For a discussion of this, see http://www.ianapperly.eclipse.co.uk/Apperly%20ST%20TT%20Final%20version.pdf.