They had been housed in an old school building after arriving in Padborg, a town in the western region of Jutland that borders Germany, but headed for the motorway, saying they wanted to go northward to Sweden.
The distance on foot is 300 kilometres to Copenhagen, then a train ride from the Danish capital to the southern Swedish city of Malmo.
The school "is not a prison and there is no fence around it. When 300 people at once decide to leave the school we take a dialogue-based approach," local police said in a statement.
Many women, children and elderly were among those marching and a smaller group of elderly people had been asked to be driven back to the school.
More From This Section
A middle-aged man shouted an expletive and made an obscene gesture at the refugees from a bridge over the motorway but left after police approached him and photographers tried to take his picture, tabloid Ekstra-Bladet reported.
Meanwhile two trains carrying around 200 refugees were being held in Rodby, Scandinavia's busiest ferry crossing to Germany.
The refugees refused to register with Danish authorities, which would mean having to apply for asylum in Denmark or going back to Germany, whereas they want to seek asylum in Sweden.
A third train from Germany carrying around 100 refugees was on its way to the harbour town, where police on Monday closed part of another motorway due to large groups of refugees walking on it.
While Sweden has become a top EU destination for refugees by issuing permanent residency to all Syrian asylum seekers, Denmark has sought to reduce the influx by issuing temporary residence permits, delaying family reunifications and slashing benefits for newly arrived immigrants.