Why would my doctor order an endometrial biopsy? Is that a cancer test?

Yes. If by us endometrium is too thick it can mean cancer and biopsy may be appropriate.
Can detect cancer. It is not necessarily a cancer test, though the biopsy can detect cancer. It may also be ordered to diagnose infection, endometrial hyperplasia, endometrial polyp, anovulatory state, hormonal disturbances and in general to evaluate abnormal bleeding.
May or may not be. Endometrial is the biopsy of lining of uterus done with a catheter usually in your gynecologist office (v/s D&C) not only just for cancer, it is for other conditions, like abnormal, bleeding & pap smear, for thickened lining or polyps, to evaluate uterine response to hormonal therapy, in infertility, and is relatively painless safe procedure.

Related Questions

Had endometrial biopsy. Doc said no cancer was found but it showed "disorganized cells". Waiting for gyn call. What does disorganized mean? What do?

Not entirely normal. Unless we can see the formal pathology report, it is hard to tell exactly what it means. When cells are not entirely normal in their appearance or orderly in their location/organization, you will see such a report. It simply means to recheck them again in the future so that your doctor can keep an eye on the observed changes which can either settle down with time or rarely, progress to cancer.