Fundamental to the function of nervous systems is the ability to reorganize to cope with changing sensory input. Although well-studied in single neurons, how such adaptive versatility manifests in the collective population dynamics and function of cerebral cortex remains unknown. Here we measured population neural activity with microelectrode arrays in turtle visual cortex while visually stimulating the retina. First, we found that, following the onset of stimulation, adaptation tunes the collective population dynamics towards a special regime with scale-free spatiotemporal activity, after an initial large-scale transient response. Concurrently, we observed an adaptive tradeoff between two important aspects of population coding-sensory detection and discrimination. As adaptation tuned the cortex toward scale-free dynamics, stimulus discrimination was enhanced, while stimulus detection was reduced. Finally, we used a network-level computational model to show that short-term synaptic depression was sufficient to mechanistically explain our experimental results. In the model, scale-free dynamics emerge only when the model operates near a special regime called criticality. Together our model and experimental results suggest unanticipated functional benefits and costs of adaptation near criticality in visual cortex.