This is quite interesting since all permission are being overlapped again and again.
Let me explain,
Your Sql Job run as a different user you connect to the server (Some cases they are the same but that's the best scenario). You can check this by running this command on the Sql Server editor (enable the xp_cmdshell as well):
and compare it with the console result (logged in as JhonDoe):
This usually takes the scenario where both results are different, so as you might guess the script is being executed as a different user so this user might have different privileges.
Then, you need to understand that whenever you try to connect to a shared folder. You'll be ask for user and password unless you are the same user as the owner of the Shared Folder. However, this can take you to a misunderstanding.
What windows really does is try to connect to the Shared Folder with the same credentials your are logged in:
You have logged in as JhonDoe with a password 123456 on the computer named PC1 so your user looks like this:
The Shared folder belongs to JhonDoe with a password 123456 (This user with this password created the Shared Folder) and the computer, named PC2, that host the Shared Folder show this:
When Windows tries to connect to the Shared Folder it uses the PC1 login (JhonDoe 123456) since this is your local login and then it compares with the remote login information and it matches exactly with the PC2 login (JhonDoe 123456). Just then, it let you access the shared folder without any prompt for password.
However, when it faces this situation:
The credentials don't match since they have different passwords. Then it fails because they are, actually, different users.