Both DOC and DOCX files have been developed by Microsoft. DOCX is the successor of the DOC file and was introduced in the early 2000s.
The main difference between the two is that in a DOC file your document is saved in a binary file that includes all the related formatting and other relevant data while the DOCX file is actually a zip file with all the XML files associated with the document. This means that you would still be able to open the DOCX file with any zip compression software if you were to exchange the DOCX extension of the file with ZIP.
Because the DOCX file was introduced later, you cannot open a document with that extension in a version of Microsoft Word from 2003 or earlier.
The way DOCX is set up makes it a lot lighter and smaller in size which is perfect for storing documents or transferring them via email.
Additionally, DOCX file allows you to work with new features when the DOC file does not.