Why nobody can recognize them when they changed their identity
Nobody can recognize Tom Canty and Prince Edward when they change identities because they look exactly alike. However, on a deeper level, they aren't recognized because so much of identity is based on clothing: the prince wears the clothes a beggar and the beggar wears the clothes of a prince. The novel critiques not looking past class in judging people.
On a surface level, nobody can identify Tom Canty and Prince Edward when they switch places because, through a twist of fate, they look exactly alike and were born on the same day. It is as if they are identical twins. However, the novel plays on the fact that much of identity is perception: we tend to judge people solely by outward appearances. When the identical Tom Canty and Prince Edward exchange clothes, the clothes, in essence, determine the two boys' identities. Prince Edward is taken for a beggar and treated very badly only because he is dressed in rags. Likewise, Tom Canty is taken for the prince only because he has put on an expensive royal outfit.
Prince Edward's words have no weight against his appearance. Likewise, when Tom Canty seems to have forgotten everything about how to behave in a royal court, rather than imagine he is an impostor, Henry VIII, his father, insists that his son's "madness" be kept hidden until he gets over it--which gives Tom a chance to learn the royal protocol. Prince Edward, now on the streets, is also considered crazy for declaring he is a prince and is treated with abuse and derision.
The novel condemns treating anyone badly just because they are poor, which, after all, is simply an outward circumstance and, especially for a young person, an accident of birth. Neither Tom Canty nor the prince deserves to be treated as badly as they are on the streets of London. Edward's experiences among the common people teaches him that the poor are not born evil, but become so because of lack of opportunity. This new insight allows him to be a better king who helps the common person.