King Alfred of Wessex didn't defeat the Danes completely. But they retreated from Wessex towards the east coast.
The land the Vikings controlled was called the Danelaw. It was northern and eastern England, while Wessex controlled southern and western England.
To protect himself and his people, Alfred fortified many towns. These were called burhs. Once they were safe places, many developed into prosperous towns of merchants.