Show only children relative to current page
Don't use the nav tag. Assuming a structure called pages, try something like this:

{% set pages = craft.entries.section('pages').level(1).all() %}
&lt;ul&gt;
{% for page in pages %}
    &lt;li&gt;
        {{ page.title }}
        {% if entry is defined and entry.hasDescendants %}
            {% set children = page.getChildren() %}
            &lt;ul&gt;
            {% for child in children %}
                &lt;li&gt;{{ child.title }}&lt;/li&gt;
            {% endfor %}
            &lt;/ul&gt;
        {% endif %}
    &lt;/li&gt;
{% endfor %}
&lt;/ul&gt;