To describe location where the action is performed, i.e. to answer the question Где? (Where?), you need a construction "
в/на + noun in prepositional case".
Я бегаю в спортзале.
Он плавает в бассейне.
Я гуляю на улице.
Птица сидит на дереве.
I run at the gym. He swims at the swimming pool. I walk in the street. A bird sits on the tree.
And if you want to describe direction of an action, i.e. to answer the question Куда? (Where to?), you need a construction "
в/на + noun in accusative case".
Я иду в спортзал.
Он бежит в бассейн.
Я выхожу на улицу.
Кошка лезет на дерево.
I am going to the gym. He is running to the swimming pool. I go out into the street. A cat is climbing the tree.
Your example belongs to the second type (direction), that's why the nouns are in accusative (which is equal to nominative for these exact words).