I was diagnosed with major depression and anxiety, how do you know it's a chemical inbalance?

No tests for such. We infer a brain chemical imbalance by the observation that treatments that augment certain chemicals in the brain ameliorate major depression and anxiety. There are, however, no clinically useful tests to measure brain chemicals in depression. Brain levels of Dopamine on pet scans are slightly increased in schizophrenia (scz), but overlap with normals and can't discriminate scz from normal.
We don't know, But we do know that adjusting the biochemical balance of the brain helps to make the depression resolve.
You don't. There is little or no scientific evidence for a "chemical imbalance" that causes major depression or anxiety. It's a shorthand phrase used to suggest that internal factors (eg, genetics) caused the problem, not external factors like stress or loss. Actually, there's no way to prove this. Treatment with meds, therapy, or both can proceed without knowing for sure how the problem originated.