People need to realize that the reason why brains are smaller in some mammals vs the size of an elephantselephant's brain, for example, is NOT because they have more information or have more knowledge. It is because of the shape and structure of their skull. If you look at a catscat's brain, it looks a lot more wrinkly because all parts of their brain must fit into their tiny skulls.
With shapeshifting, I think memory is an important factor. If they can shapeshift exactly like another organism, that means they had the visual technique and memory to be able to transform like them. So looking at the brain as a whole, the part of the brain that takes care of memory and vision would be primarily responsible for the action of shapeshifting. BUT those two are obviously not the only ones that would be affected. more scientific factors would be involved, much too complex and quite impossible to explain.