I am having difficulties to understand why in mathematics when calculating line integrals using gradient theorem we use F=grad(U), and in physics it is always F=-grad(U)? It seems important to me, because I may end up getting answer with opposite sign.

Is it somehow related to Newton's third law?
 Recognitions: Gold Member Homework Help Science Advisor Only those forces we call "conservative" will be gradients of scalar fields. You'll meet other types of forces that are not conservative, for example forces of friction.
 If we put them into a common context, then F is a force field. A line integral of F represents the work done by the force field on a free particle that traverses that path. The amount of work done is equal to the particle's gain in kinetic energy, which is equal to its loss of potential energy. So when physicists flip the sign, they are accounting for changes in potential energy rather than changes in kinetic energy. Outside this physical context, there is no reason to flip the sign. You just use the fundamental theorem of line integrals.