Lemma $1$: divisibility of $f$ by $y$ is a $f(y)$-periodic function.
Proof: Suppose that $f(y)=k$. Then with $x=1$, exactly one number in $$\{f(2), f(3), \cdots, f(1+k)\}$$ is divisible by $y$. Let $n$ be such that $2\le n\le 1+k$ and $y|f(n)$. Then for $x\in\{1, \cdots, n-1\}$, the condition will hold because $f(n)$ will be in the set. Additionally, that would force all $m\in\{n+1, \cdots, n+k-1\}$ to have $y\not|f(m)$. But then for $x=n$, since we need some element in the set to be divisible by $y$, we need $y|f(n+k)$. Continuing on in this way, it must be that $[y|f(m)]\iff m\equiv n\pmod k$. QED
Lemma $2$: $f(n)|f(mn)$ for all $m,n\in\mathbb{N}$.
Proof: divisibility of $f$ by $mn$ would be a $f(mn)$-periodic function by lemma 1. Since divisibility by $mn$ implies divisibility by $n$, and divisibility by $n$ is a $f(n)$-periodic function, it must be that the period divides $f(mn)$. QED
Lemma $3$: $n$ divides $f(n)$ if and only if $f(n)=n$.
Proof: with $x=n-1$ and $y=n$, we have that only one out of $f(n), \cdots, f(n-1+f(n))$ can be divisible by $n$. If $n|f(n)$, by lemma $2$, $n|f(2n)$. But from the condition, since $n\le 2n\le n-1+f(n)$ if $f(n)>n$, it would be true that both $f(n)$ and $f(2n)$ are divisible by $n$, a contradiction of what must be true of $f$. QED
Lemma $4$: $n$ divides $f(m)$ if and only if $f(n)$ divides $m$.
Proof: Fix an $n$, and let $k=f(n)$. We know that there must be some number divisible by $n$, so let such a number be $m$. Since divisibility by $n$ is $(f(n)=k)$-periodic, we know that $[n|f(r)]\iff r\equiv m\pmod k$. We also know that $f(m)|f(am)$ for all $a\in\mathbb{N}$.
We simultaneously have, $n|f(m)$, $f(m)|f(am)$ for all $a\in\mathbb{N}$, and $[n|f(r)]\iff r\equiv m\pmod k$. We will try to figure out when there is a contradiction. The first two imply that $n|f(am)$ for all $a\in\mathbb{N}$, but if $r\not\equiv m\pmod k$, then $n\not| f(r)$. So if there is some $a\in\mathbb{N}$ with $am\not\equiv m\pmod k$, there will be a contradiction. Thus, we need $m$ to be a multiple of $k$ in the given range.
Then from $[n|f(r)]\iff r\equiv m\equiv0\pmod k$, we get that $[n|f(r)]\iff [k|r]$. QED
Now for the final statement:
Theorem: there are infinitely many $n$ with $f(n)=n$.
Proof: suppose this were false. Then there would be some $N$ with $f(n)\not=n$ for all $n\ge N$. Let $p$ be a prime larger than $N$. Let $n=p$ and $k=f(n)$. Then by lemma $4$, $f(k)=pa$ for some $a\in\mathbb{N}$. From the choice of $p$, we know that $k\not=p$, so from lemma $3$, $k$ can't be a multiple of $p$, and since $p$ is prime, $\gcd(k,p)=1$. We have that $f(pk)$ must be divisible by both $f(p)=k$ and $f(k)=pa$. Since $\gcd(k,p)=1$, we have that $f(pk)$ is divisible by $pk$, but again, by lemma $3$, this would mean that $f(pk)=pk$. Since $pk>p\ge N$, this contradicts the fact that for all $n\ge N$, $f(n)\not=n$. QED