The Structure and Evolution of the Lagoon Nebula. I. Submillimeter Continuum and CO Line Mapping