I'd guess it's usually up to the developers/owning team, but also to some extent depending on the ecosystem it's interacting with (e.g. Hadoop would tend to prefer Java)
Often comes down to the preference of the engineers in a given team and evaluating pros and cons with engineers outside their team (aka review their plans before they start building)