If you've been convicted of a felony in the USA you lose a lot of rights - it can affect your credit score, your ability to get a job, your right to vote, etc. When a felony is expunged from your record, however, it is (in most ways) as if the crime never happened. While the felony will remain in a few select places, such as immigration records, it is not viewable by prospective employers or credit agencies. Expunging a felony, however, is not easy and is not something that is automatically done after a certain period of time. You have to fight to have your felony expunged and some cases don't even allow expungement at all (especially if you have been charged with certain crimes).
First of all you must complete your sentence in full. If you are sentenced to serve jail time, for instance, you must complete all jail time prior to expunging your felony. If you have multiple charges they may either run concurrent or consecutively. If you are released early for any reason (overcrowding, good behavior, etc.) you are considered to have served all of your time.
You must complete all of the terms of your probation successfully. This may include reporting to the court or a probation officer monthly for a period of time, paying back a fine to the court, paying restitution, etc. All of these terms should be clearly spelled out by the court at the time of your sentencing.
Beyond the period of probation you must establish for the court a pattern of good behavior. Usually this needs to be for at least three or four years - this is not a fast process. You need to stay out of all criminal behavior - anything (except a minor traffic offense) could jeopardize your chance of expunging your felony.
After establishing a period of good behavior, you must appeal to the court to have your felony expunged. This should be in a letter outlining everything you have done to right your wrong and ensure that you will never break the law again.
The final step is waiting for the judge to approve your expungement. This can take a long time and requires a lot of patience, but in the end you will be glad you went through the process of clearing your record.