I have a simple layout with two EditText fields. One for the username and one for the password.
<EditText
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAutofill="yes"
android:inputType="textPassword"
android:minWidth="200dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAutofill="yes"
android:minWidth="200dp"
app:layout_constraintBottom_toTopOf="@id/password"
app:layout_constraintStart_toStartOf="@id/password" />
In the code (onCreate method) I add hints to those EditText views like this
findViewById<View>(R.id.username).setAutofillHints(AUTOFILL_HINT_EMAIL_ADDRESS, AUTOFILL_HINT_USERNAME)
findViewById<View>(R.id.password).setAutofillHints(AUTOFILL_HINT_NEW_PASSWORD)
When I tap the password fiels it suggests creating a password for me, but the username is empty. I understand that there's no way to control what autofill service does and there are many different implementations of them. I want to know if there's a way to make the Google Password Manager specifically to pick up the value from the username field and populate it for me.

It seems your code is fine, However, there could be a few reasons why autofill might not be working as expected:
Try to set input type in your XML as well:
You can try to use a single, specific autofill hint for each field.