Group by + Order by Behavior Explanation?
The order of execution for SQL query is 


FROM & JOIN -determine table & filter rows
WHERE -more filters on the rows
GROUP BY -Combine rows in group
HAVING - filters on group
ORDER BY - arrange the remaining rows



  Does group by get a random record from the table ?


Answer is No.


  Is Order by working first and then Group by gets the first record?


Answer is No.

How the query execution happen will tell us the reason,
In the query that you have added, FROM provider,piece,provides is executed first, then WHERE provider._id = provides.ProviderId
AND piece._id = provides.PieceId
AND provider.Name LIKE 'A%'
after that GROUP BY followed by ORDER BY clause.

EDIT:

Check Sqlite select for more details.