I don’t think this is a bug, you searched for a taxon got 759 results and the first one happens to Order Piciformes (from “Tucanos, Pica-Paus e afins”), and this is the correct photo for that taxon. I think for your purposes you want to find an exact match for “Pica pica” (maybe that is a filter you can include that in the url or something?), but anyway I would suggest using the taxon ID (891696) since that is less likely to be misinterpreted.
I merged your reports and changed the title to reflect the shared cause of both of them. When you search for a name that has the same genus and species epithet (a tautonym), the API doesn’t process it as a true genus and species combination. This is a known issue that is already documented on github: https://github.com/inaturalist/iNaturalistAPI/issues/605
I think it is the logic in the search query that is to blame here, when you search for “Pica+pica” the search returns results that include Pica and/or pica (anywhere in the name). Since the case probably isn’t taken into account it is really just looking for results that have Pica/pica and/or Pica/pica in them, so it sees “Tucanos, Pica-Paus e afins”, and Pica/pica is present, as is Pica/pica, so that is as good as it gets, along with the other 759 results that have Pica/pica in them. Then I assume it sorts by popularity or number of observations, so Piciformes is returned as the top result.
If you want this to work then I assume you will need to have the whole query “Pica pica” (including the space) taken into account rather than just the individual words.
Note that even if they searched for “Pica+pica”, it would still just be a prefix search, not an exact string search. The iNaturalist API doesn’t support exact string searches: https://github.com/inaturalist/iNaturalistAPI/issues/336.