Querying posts from two different categories while looping inside another loop

You should not be using query_posts() for this or anything else.

For secondary loops you should be making new WP_Query instances. Since you can (and should) assign instances to different variables they won’t interfere with each other.

So your structure would be roughly like this:

$outer_query = new WP_Query();

while( $outer_query->have_posts() ) : the_post;

    $inner_query = new WP_Query();

endwhile;