Allot will depend on what you are trying to achieve when using these file types but, here is some knowledge information explaining the differences between DWG and DXF file formats. I hope this helps.
If this posts helped answer your question, please click Accept as Solution on the post so others in the community can find them easily.
DWG is Autodesk's proprietary format for AutoCAD drawing files.
DXF is a format created by Autodesk to facilitate the translation of CAD data from other programs to AutoCAD or vice versa. For example, you might use XYZ CAD (made-up name) and it has it's own proprietary format, unreadable by AutoCAD. XYZ CAD would then likely have an export routine that would write from their proprietary format to Autodesk's DWG format, allowing XYZ users to collaborate with AutoCAD users.
*Why* are there two formats - DXF so that Autodesk users aren't *completely* roped into the AD ecosystem, and DWG so that AD can *try* to do so..