The gel sieves the DNA by the size of the DNA molecule whereby smaller molecules travel faster. Double-stranded DNA moves at a rate that is approximately inversely proportional to the logarithm of the number of base pairs.  This relationship however breaks down with very large DNA fragments and it is not possible to separate them using standard agarose gel electrophoresis.  The limit of resolution depends on gel composition and field strength. and the mobility of larger circular DNA may be more strongly affected than linear DNA by the pore size of the gel.  Separation of very large DNA fragments requires pulse field gel electrophoresis (PFGE).  In field inversion gel electrophoresis (FIGE, a kind of PFGE), it is possible to have "band inversion" - where large molecules may move faster than small molecules.