Because imports (and assignments generally) bind names to values, they
don't alias names to other names.
from foo import *
can be thought of as essentially doing:
set = foo.set
var = foo.var
So the new, separate name __main__.var gets the current value of
foo.var at import-time, which is the integer 0.
You then call foo.set(), which re-binds foo.var to a new value (i.e.
1) rather than mutating the existing value (which would be impossible
anyway since integers are immutable). This has absolutely no effect on
__main__.var, which is an entirely separate binding.
The behavior is comparable to that of function arguments. Values can
be mutated, but re-binding names has only local effect:
.... b = 1 # rebinds local name b
.... b.append(99) # mutates passed-in value
.... b =  # rebinds local name; has no outside effect