Bubble sort walks the array comparing each pair of neighbors and swapping them when they're out of order. After one full pass, the biggest value has 'bubbled' to the end, guaranteed. Each following pass locks the next-biggest into place.
It's the friendliest sorting algorithm to understand, and the slowest one you'd ever use: every pass scans nearly the whole array, giving O(n²) time. Real systems use quicksort or mergesort, but bubble sort is where the idea of 'sorting by swapping' clicks.