So in this case "working" and "hearing" are gerunds that are the objects of their respective verbs.
There are no real rules that hold for all cases. Some verbs take both infinitives and gerunds, some just take gerunds and some take only infinitives.
This like may help you Using Gerunds and Infinitives
Student or Learner