Coming from the base meaning of the
noun 中(なか) meaning 'inside', the addition of the
case marking particleを in its role of identifying the place where an action is taking place creates a grammar structure that can be translated as 'doing (B) in (A)', 'doing (B) on (A)', or 'doing (B) inside of (A)'.
With this grammar point, (B) will be the action, while (A) will be a noun indicating the location.
家(いえ)に帰(かえ)ってきたら、まずは弁当(べんとう)箱(ばこ)の中(なか)を空(から)にしてっていつも言(い)ってるじゃん!
I always tell you to empty out the lunch box first thing when you come home, don't I?
スーパーの中(なか)を何(なに)も買(か)わずにウロウロしていたら、警備員(けいびいん)のおじさんに怪(あや)しまれて声(こえ)をかけられた。
When I was wandering around the supermarket without buying anything, the security guard thought I was suspicious so he came to talk to me.
Caution - The person or thing that is doing the action that
中(なか)を is indicating may not actually be within the noun being marked with (A). A good example of this is 'doing (B) into (A)', such as with the う-Verb 覗(のぞ)く 'to peer'.
子供(こども)が妙(みょう)に静(しず)かだな〜と思(おも)い、子供(こども)部屋(べや)の中(なか)を覗(のぞ)いてみたらただ寝(ね)ていただけだった。
I thought, 'My kid is suspiciously quiet', so I peeked into their room, but they were just sleeping.