The idea is that Class A doesn't really need to know about Class B, it just needs to know how to use Class B, which is to say it needs an interface to call, and doesn't really care who is calling it.
So if Class B looks like this:
And Class A needs to doSomething(), like you said, one way Class A could work is to call on an instance of B:
But now A has to know about B, and what happens when I want to change how B works, or add a different class C and let A work with either.
To make it so A doesn't really have to know about B (and so could work with C or D later on) we create an interface that mimics the methods A needs:
This just defines a method that can be used on any class that implements SomethingI. I can then code A against this interface:
And if I make B implement the SomethingI interface I can use it in A:
So now A is using B, but doesn't really know it - and doesn't care. A just cares about SomthingI. Which means when class C comes along I can use that without modifying A: