macOS and File Owner information
No, the name is not the crucial factor. Each user account has an ID number (UID). The first-created user account is normally number 501, then next is 502, etc.
If Mac1 has account called &quot;Dave&quot;, but has a UID of 502, then files saved on that Mac will be considered a different user account when used on account &quot;Dave&quot; #501 on Mac2. This will cause problems with file ownership and read/write access.
Also, bear in mind that if the OS can't find the user folder at boot, it will recreate a new empty account with that name in the default location.
(If you're looking to sync files between two different Macs, there are better ways of doing it.)