The history of St Giles begins with the foundation of Barnwell Priory of Augustinian Canons by Picot, Sheriff of Cambridgeshire at the time of Domesday and Lord of Bourn and Madingley, who built a church of St Giles by Cambridge Castle in 1092 in fulfilment of a vow made by his wife Hugoline when she fell ill. The house had 6 canons, but Picot and Hugoline died very shortly after the foundation and their son Robert fled overseas for his life after the rebellion of 1095, in which he was involved, failed. His holdings reverted to the crown, and the Barony of Bourn, to which the priory belonged, was eventually given by Henry I to Payn Peverel who increased its endowments and relocated the priory to Barnwell, a mile to the E. St Giles continued as a small church just outside the town walls.
In 1092 it lay within the diocese of Lincoln, but it passed to Ely when that diocese was formed in 1109.