To derive this we need to use the completeness of $\mathbb{R}$:
Every nonempty set of real numbers that is bounded above has a supremum in $\mathbb{R}$.
There are two approaches to this, the axiomatic approach (where it is an axiom) and the constructive approach (where it is a theorem). More information can be found in analysis texts.
Now we prove the Archimedean property of $\mathbb{R}$:
$\mathbb{N}$ is not bounded above in $x\in\mathbb{R}$. That is, for each $x\in\mathbb{R}$ there exists $n\in\mathbb{N}$ such that $n>x$.
For $x<0$ it is trivial. Suppose $x\geq0$. Let $A=\{n\in\mathbb{N}\ ;n\leq x\}$. By completeness we have $\sup A\in\mathbb{R}$. Obviously, there is $a\in A$ such that $\sup A-1/2<a$ (Why?), then let $n=a+1$ and $n>x$ and the theorem is proved.
Finally, we turn to the question:
For any real number $a>0$, there exists a natural number $n$ such that $0<1/n<a$.
We proceed using proof by contradiction. Let $0<1/n<a$ for all $n\in\mathbb{N}^{\times}$, then $n\leq 1/a$ for all $n\in\mathbb{N}^{\times}$. Thus $\mathbb{N}$ is bounded in $x\in\mathbb{R}$, contradicting the Archimedean property.
Here's a solution that doesn't require any differential equations or special functions:
Like I mentioned in my comment, first note that $f(x) = 0$ is impossible, so since $f(0) = 1$, $f$ must stay positive by continuity. Then just multiply out everything in the inequality and rearrange terms to get
$$\frac{1}{f(x)} + \frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \leq 2$$
for all $x > 0$. This gets us
$$\frac{1}{f(x)} \leq 2 \implies f(x) \geq \frac12$$
for all $x$ and in general if $a_0 \in(0, 1)$ is a lower bound of $f$, then we get
$$\frac{1}{f(x)} \leq 2 - \frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \leq 2 - a_0 \implies f(x) \geq \frac{1}{2-a_0}$$
for all $x$, with $\frac{1}{2-a_0} \in (0, 1).$ Thus we get a sequence $(a_n)$ of lower bounds satisfying $a_0 = \frac12$ and
$$a_{n+1} = \frac{1}{2-a_n}$$
for all $n$. This sequence is increasing and hence converging to $1$, the only solution of
$$a = \frac{1}{2-a},$$
so we know that $1$ is a lower bound of $f$.
Now we will show that $1$ is also an upper bound: Assume towards a contradiction that there is an $x_0 > 0$ such that $f(x_0) > 1$. By continuity this must also be true in a neighborhood of $x_0$, so we get
$$\frac{1}{x_0} \int_{0}^{x_0}f(t) \mathrm{d}t > 1.$$
Now note that since $f$ is positive, the inequality in its initial form implies
$$f(x) - \frac1x \int_0^x f(t) \mathrm{d}t \geq 0$$
for all $ x > 0$ and we conclude
$$\frac{\mathrm{d}}{\mathrm{d}x} \left(\frac1x \int_0^x f(t) \mathrm{d}t\right) = \frac{xf(x) - \int_0^x f(t) \mathrm{d}t}{x^2} = \frac{f(x) - \frac1x\int_0^x f(t) \mathrm{d}t}{x} \geq 0,$$
i.e. $x \mapsto \frac1x \int_0^x f(t) \mathrm{d}t$ is nondecreasing. Thus there exists a $b_0 \in (1, 2)$ such that
$$\frac1x \int_0^x f(t) \mathrm{d}t \geq b_0$$
for all $x \geq x_0$. For those $x$ we conclude
$$\frac{1}{f(x)} \leq 2 - \frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \leq 2 - b_0 \implies f(x) \geq \frac{1}{2-b_0},$$
but now we don't quite get this as a lower bound for $\frac1x \int_0^x f(t) \mathrm{d}t$ because this is only true for $x \geq x_0$. Nevertheless we can get arbitrarily close to getting that lower bound for sufficiently large $x$, meaning we can pick any $c \in (0, 1)$ and then there is an $x_1 \geq x_0$ such that
$$\frac{1}{x} \int_{0}^{x}f(t) \mathrm{d}t \geq \frac{c}{2-b_0}$$
for $ x \geq x_1$. We would like to construct an increasing sequence of
lower bounds $(b_n)$, so we also need
$$\frac{c}{2-b_0} > b_0 \iff c > b_0(2 - b_0).$$
This suffices to get an increasing sequence because the map $x \mapsto x(2 - x)$ is decreasing on $(1, 2)$, so if we construct a $b_n \in (b_0, 2)$ then we also get
$$c > b_0(2 - b_0) > b_n(2 - b_n) \implies \frac{c}{2-b_n} > b_n.$$
Now we iterate again and this gives us an increasing sequence $(b_n)$ of lower bounds satisfying
$$b_{n+1} = \frac{c}{2-b_n}$$
and $ b_n \in (1, 2)$ for all $n$. (These are not global lower bounds, each of them is only valid on some interval $[x_n, \infty)$.) Since $(b_n)$ is increasing and bounded above by $2$ it must converge to a solution of
$$b = \frac{c}{2-b},$$
which are $1 - \sqrt{1-c}$ and $1 + \sqrt{1-c}$.
Since only the latter is larger than $1$ it must be the limit, but we know that
$$\frac{c}{2-x} < x$$
for all $x \in (1 - \sqrt{1-c}, 1 + \sqrt{1-c})$, contradicting the fact that $(b_n)$ converges to $1 + \sqrt{1-c}$ from below.
Thus $1$ must also be an upper bound for $f$, leaving us with $f \equiv 1$ as the only solution to the inequality.
Best Answer
$f$ is called the Lambert $W$ function. Subsitute $s=f(x)$, then $x=se^{s}$ thus $dx=(1+s)e^sds$ : $$ \int_0^e f(x)dx=\int_0^1 s(1+s)e^sds=\left[(s^2-s+1)e^s\right]_0^1=e-1 $$