Why does wallet.dat differ after running? What information is exactly saved inside the wallet.dat file? When I run the bitcoin daemon, then stop, then compare the new wallet.dat file with the old one, the binary files differ, although I didn't make any new transactions. Can you explain the reason of this behavior?
The wallet contains a lot of metadata, and is actually a database rather than a flat file. At a minimum it contains a record of where you were last synced to in the chain, allowing any node that loads this wallet to pick up where it left off.