Your were told wrong. Anytime you file for I-485,at the same time you should apply for the work authorization if you wish to work in the U.S. Most likely your I-485 was denied, among other things, because you woeked without authorization.
As a first steo, what you can do is to send the USCIS a letter to reconsider your application. if that does not work, you will need to refile your I-485 with the I-765. Keep in mind even if you file for your work authorization this time, that does not erase the past unauthorized employment. This time you will need to file a waiver with your application.
All the best.