Michael explains it very well. In general, there's a volume sense to "expand", and a linear or directional sense to "extend".
For instance, if you said you were going to EXPAND production in a factory, then you are going to increase volume of production. If you said you were going to EXTEND production, it would mean you were going to linearly extend through time the hours of production. Production hours are going to be increased or extended in time.
But often the terms are interchangeable and volume/direction overtones mean nothing.
As an example, in common usage I can both say, "I am expanding/extending the volume of my dam." The meaning remains the same - I'm increasing the capacity of the dam.
Until you familiarize yourself with all the usages and when they can be interchanged, I'd suggest using 'expand' when there is a volume sense - literal or metaphorical, and 'extend' when the overtone is somewhat linear .... time/distance, etc.
There'll be exceptions I'm sure, but you'll escape trouble most times this way.