"there is a function called entropy that increases over time?"
I think your confusion stems from this unsubstantiated assumption.
Entropy in thermodynamics is not a function of time or canonical variables from mechanics like $q,p$. Boltzmann's $H$ function is, but this is not thermodynamic entropy!
Thermodynamic entropy is a function of thermodynamic equilibrium state variables, like $U,V$. There is a connection between thermodynamic entropy and distribution function in phase space we use to describe the thermodynamic system in statistical physics, but this connection is in terms of principle of maximum information entropy (different thing from thermodynamic entropy). In short, in case the system is in equilibrium, its thermodynamic entropy is maximum possible information entropy given macroscopic constraints(thermodynamic state variables like $U,V$).
The connection to mechanics is not so direct as to have a function of time whose value at all times would equal thermodynamic entropy. That is not possible, since thermodynamic entropy does not exist all the time, only in equilibrium states (and possibly can be extended to some close-to-equilibrium states)
If your question is also how can mechanical system tend invariably to equilibrium when the equations are symmetric in time, the answer is, this does not follow purely from mechanics at all. One needs some additional assumption that breaks the time symmetry - for example, it is common to assume the final condition (equilibrium) and reason back to what past states are possible (the final condition restricts possible past states).
Different way to make sense of evolution to equilibrium is through probabilistic considerations. In short, the idea that majority of isolated systems evolve towards equilibrium is valid because, given initial macroscopic state that is not equilibrium, almost all microstates compatible with the initial macrostate lead to evolution towards equilibrium macrostate, and that is because there is overwhelmingly more microstates compatible with equilibrium macrostate than some non-equilibrium state.