How do I do that?

I need to make an object circling another object. The problem is the orbiting object has to pass before and then behind the other.
How can I do that?

You can animate the Z position in small increments. This can be done in the function editor or by using Alt+down/up arrows with the transform tool.

This way you can have the orbiting object be at a Z in front for some frames and behind for others.