in kh2 the keyholes are to unlock the lanes between, as to why traverse town has two keyholes no idea.
as for the clothing change, i believe its cuz in dreams the dreamer,ie sora, doesnt have true control of whats happening. kinda like the naked in high school dream we all experience lol