Functional connectivity (FC) can provide insight into cortical circuit dysfunction in neuropsychiatric disorders. Since FC is usually measured during rest (e.g. resting state fMRI), locomotion-based tasks on FC thus remains unexplored. To investigate FC in behaving states, we developed an integrated calcium imaging and virtual reality environment. We found evidence of profound and rapid reorganization of functional cortical networks in response to changing behavior states. Locomotion induced a rapid decoupling of sensory regions and greater coupling between motor regions, resulting in more pronounced modular network organization, compared to rest. Remarkably, 15q dup mice, a model of autism spectrum disorder (ASD), displayed a globally hyper-connected functional cortical network with their correlation changed poorly in association with locomotion. Furthermore, highly accurate machine learning classification identified FC patterns involving the secondary motor area as the most distinguishing features of the ASD mice from wild-type mice. Our findings highlight the importance of motor areas in cortical FC dysfunction during spontaneous behavioral switching in autism.