Latios is a roaming Pokemon, so it has the ability to escape.
But, Diglett, with Arena Trap should have prevented Latios to escape,
BUT, latios has the ability Levitate, so it negate the ability Areana trap so therefore was able to escape.
Source: Knowlege, experience
Tip: Use an Pokemon with other preventing escape abitilies such as Shadow tag or moves like Mean look