Assuming you mean "when she returned" (since "when she was back" is not natural English):
When she returned, I decided to do my homework
She came back, and then I made the decision to do my homework.
I decided to do my homework when she returned
I decided in advance to do my homework at the time when she returned. Although it can also mean that you decided at the moment she came back, this would not be my initial interpretation.
When she returned, I was going to do my homework
At the time she returned I intended to do my homework (but then something happened).
I was going to do my homework when she returned.
Either I had planned to do my homework at the time she came back (but then something happened), or her returning interrupted my intention to do my homework.