The problem is that node_submit() contains the following code.
if (user_access('administer nodes')) {
// Populate the "authored by" field.
if ($account = user_load(array('name' => $node->name))) {
$node->uid = $account->uid;
}
else {
$node->uid = 0;
}
}
When it's not able to load the user object having $node->name
as username, it sets the user ID to zero.
As you have already set the values for the node object, it is useless to pass the node to node_submit()
; it would be better to just pass it to node_save()
.