Is it safe to have two circuits passing through one junction box?
That's what's known as a Multi-wire Branch Circuit, and it's perfectly acceptable if done properly.   Though it sounds like yours is not.

First, the ungrounded  (hot) conductors must be on separate legs of the service.  Secondly, the breaker(s) protecting the circuit must have the handles tied together, or a double pole breaker should be used. 

To fix the problem, install an appropriately sized double pole breaker. The red wire will connect to one pole, and the black to the other.  That way both circuits will always be turned on/off at the same time.