order() returns the index of the elements when the vector is arranged in an ascending order

 x<- c(5,3,4)

So, order(X) will give the indexes of values(arranged in an ascending order) pointed by X.

When you apply order()  on the x variable, 3 is the smallest among(5,3,4) it returns the index of 3 i.e. 2
Next, 4 is the second smallest among (5,3,4), so it return the index of 4  i.e. 3 
Next, 5 is the third smallest among (5,3,4), so it return the index of 5 i.e 1
Hence the output is   2 3 1

Hope this helps you.