1) Fix swap, you're passing by value. Which means after swap is called nothing was changed!
2) The max_heapify function is wrong. Your left and right child calculation is off by 1. When you swap, you swap an index with an array value, yikes.
3) heapsort for-loop is wrong. You should put the first element (largest one in the heap) to the last index of the current heap, decrease the size of heap so the last element is part of the sorted list and not the heap. Then you perculate down from the root, not from the last element. Should be:
for(i= len-1;i>=1;i--)
{
swap(arr[0],arr[i]);
heapsize = heapsize -1;
max_heapify(arr,0);
}