In case somebody is wonderind (and is too lazy to look at the helpful link onyxpanda put), is because the dutch sailor that said have invented the hole in doughnuts wanted to keep his hands free to steer. After that, it's simply because doughnuts are heavily associated with their holes, so most bakers simply make them with the hole out of tradition