How to pray is mentioned in the Hadith. Some Hadiths are from god and not from Muhammad and they're called Hadith Qudsi. The Hadiths are important because Muhammad was telling what Jebril (peace be upon him) told him from god. People were asking many question about Islam and how to do things or why things are like that, that's why Hadiths are important to clear the confusion and answering questions, but not all of them are right. And Jabril was telling all the prophets the messages from god not just Muhammad, but Jesus, Muses, Noah, Lut, Solomon, etc. Some Muslims follow just the Qoran and ignore the Hadith, but they don't pray or do many things that were mentioned in the Hadith, that's why they're important.