The following is from a thermodynamics perspective, rather than statistical mechanics.
I've read that equilibrium is the state at which entropy has a
I believe you are referring to the maximum entropy principle. If so, from a thermodynamics perspective, the maximum entropy principle states that for an isolated system (a system for which there is no energy or mass transfer with the surroundings) the entropy is maximized at equilibrium. (See https://en.wikipedia.org/wiki/Principle_of_minimum_energy#:~:text=The%20maximum%20entropy%20principle%3A%20For,energy%20is%20minimized%20at%20equilibrium.)
However I found this definition paradoxical because on books entropy
is usually defined only for equilibrium states
Yes, entropy is a (equilibrium) thermodynamics state property. But I don't believe there is a paradox.
For an isolated system if the system is not in internal equilibrium, entropy is not maximized. Only when it comes to internal equilibrium is entropy maximized. And if it is not in internal equilibrium it can only be brought to internal equilibrium as a result of an irreversible process, which by definition generates (increases) entropy.
Take the often used example of the free expansion of an ideal gas into a vacuum. The system consists of an ideal gas and a vacuum separated by a partition bounded by a rigid, thermally insulated vessel. So we have an isolated system (no work, heat, or mass transfer with the surroundings). The gas (one part of the system) is initially in internal equilibrium and the vacuum (the other part of the system) is in internal equilibrium, but the gas and the vacuum are not in equilibrium with each other due to the pressure and temperature difference (temperature of a perfect vacuum being zero).
In order to bring the two parts of the system into equilibrium, an opening in the partition is created and the gas allowed to freely expand into the vacuum until equilibrium is established. The process is irreversible and entropy is generated (entropy increases). For the process, $\Delta U=0$ and for an ideal gas $\Delta T=0$. The change in entropy can be calculated by assuming a reversible isothermal path connecting the initial and final states of the system. The entropy of the new state of the system is now maximized.
Hope this helps.