The worst case occurs when the partition function always picks greatest or smallest element as pivot. If we consider last element is always picked as pivot, the worst case would occur when the array is already sorted in increasing or decreasing order.
The normal time complexity of quicksort is
T(n) = T(k) + T(n-k-1) + theta(n)
The first two terms are for two recursive calls, the last term is for the partition process. k is the number of elements which are smaller than pivot.
In worst case scenario k=0
T(n) = T(0) + T(n-1) + theta(n) = T(n-1) + theta(n)
The number of swaps in the worst case scenario is the time complexity of the partition function and the number of times the partition function is called.
So, partition function is called n times in the worst case scenario and we all know the time complexity of the partition function is O(n) making maximum number of swaps O(n2).