A class rarely needs only itself. Sending an invoice needs a mailer, which in turn needs credentials. The question is who puts these parts together.
The obvious answer would be that each class fetches its own dependencies. That ties it firmly to one particular implementation. The service container turns it round. A class states what it needs and is given it. The principle behind that is called dependency injection.
Why it counts in practice
First, tests. If a class is given its mailer, a stand-in can step in during a test that sends nothing but records what would have been sent. Without that separation, every test would have to produce real mail or be left out altogether.
Second, replaceability. Changing a payment or shipping provider then touches a single place rather than every class using it.
Third, clarity. What a class needs stands visibly in its signature rather than turning up hidden somewhere inside it.