It probably existed in some form in a defensive capacity before the Norman conquest, possibly being dug during the Danish era. In the early-to-mid 1200s it was more of a rubbish dump.
King Henry III, as part of his campaign against rebel barons in 1267, made it a more formidable obstacle and erected gates at Trumpington Street and St Andrew's Street (then called Preacher Street, after the preaching Dominican Friars). The latter gate caused Preacher St. to deviate from the straight line of Roman road at that point.
In the following centuries the ditch featured in the regular complaints relating to street cleaning - the town was supposed to keep the streets clean and the ditch free-flowing.
Dr. Perne's scheme of 1574 aimed to cleanse this. Richard Lyne's map of 1574 shows it truncated at the end of Free School Lane and no gate at Trumpington Street.