"What do you buy?"
かいます is an action Verb. Hence we need a particle to show the object upon which it is acting. When you say 何 かいます- there is no relationship between what and buy 【what 】 【buy 】. It is like randomly blurting "what" "buy"
The sentence 何を買います is : 【what 】<--【buy 】 the を helps establish this relationship between what and buy
Rofl, thank you for the image of someone randomly yelling "WHAT BUY??????" in a dollar store.
Not if you already know a language with cases. をlooks like it puts the previous word into accusative. I'll probably be proven wrong, but it works for now. :)
When を is used as a particle (which is almost always) you pronounce it as 'o'. Also I think nani is almost always shortened to 'nan',but I'm not sure about that.
Thus: nan o kaimasu ka
なに is not shortened to なん; they are simply different pronunciations used depending on what follows the word. They're not interchangeable.
i entered かいを何ですか and it was wrong why is nani the object instead of kai?
Think of what as a pronoun. It's substituting something that you are buying. Like "What are you buying? I'm buying a thing" What's the object of the second sentence? "A thing". And as what is substituting "A thing", it's also an object.
です is a (polite-form) copula that usually means a form of "to be"; ます is just a suffix that turns a regular verb into its polite form.