If I buy the best CPU at the start of the game, and then upgrade my gateway, will the new gateway have my CPU installed in it or will I lose it?
Yes, your hardware will be transferred into the new gateway, assuming the gateway supports it. If your new gateway does not support a particular piece of hardware (e.g. your current modem is 10GQps, new gateway only supports up to 8GQps modems), it will be lost. If your new gateway doesn't have enough slots to fit all the components of a particular type, the extra components will be lost too.