Autopilot

It's better to learn the way it works in xplane as this is more true to the real life autopilot. What it basically comes down to is that you set your desired altitude to the clearance given in the ground by ATC (or you choose one yourself depending on your realism desires), take off, set your desired climb rate (this is what fsx mostly does for you automatically) and then activate the autopilot to altitude mode. Once you reach your pre set altitude, the autopilot will switch to altitude hold mode automatically. To change your altitude afterwards, again first set your new desired altitude, then climb/decent rate and activate the altitude mode again.

/r/Xplane Thread