The meanings of both are the same, but the usage is different.
なに （何） can be on its own and means "what."
Example: 何をしていますか？ "what are you doing?"
なん （何）is used as a prefix attached to other words to form a phrase. なん is often used in combination with particles, such as the example you gave above: 何時ですか？= "What time is it?"