First of all you need to have an inner product space (there are other ways to define it, in my functional analysis class we defined adjoints on general Banach spaces. But don't worry about that). We generally assume that the inner product space is "complete" or Hilbert. Don't worry about it now if you don't know. We will just consider inner product spaces.
An inner product space is a vector space, ##V## over ##\mathbb{C}## (or ##\mathbb{R}##) with a function defined on it.
$$(,)\colon V \times V \rightarrow \mathbb{C}$$
(or ##\mathbb{R}##)
such that:
##(v,v)\geq 0## for all ##v \in V##
##(v,v)=0## iff ##v=0##
##(u,av+bw)=a(u,v)+b(u,w)## for all ##a,b\in \mathbb{C}## and ##u,v \in V##
##(u,v)=\overline{(v,u)}## for all ##u,v\in V##
If you have a linear map, ##A\colon V\rightarrow V##, the adjoint ##A^{\ast}## is a linear map such that:
##(u,Av)=(A^{\ast}u,v)## for all ##u,v\in V##
Basically, the adjoint is what allows you to move an operator from one side of an inner product to the other. So in your question, what is the adjoint of ##\frac{d}{dx}##? First of all you need an inner product space. Let ##V=C^{\infty}_{c}(\mathbb{R})## be the vector space of all compactly supported smooth functions (for simplicity, let's consider only real functions). You can check that this is a vector space (proof is LTR =) ), let the inner product be:
$$(f,g)=\int_{-\infty}^{\infty} f(x) g(x) dx$$
So
$$(f,\frac{dg}{dx})=\int_{-\infty}^{\infty} f(x)\frac{dg}{dx}(x) dx$$
We may integrate by parts
$$(f,\frac{dg}{dx})= f(x)g(x)|_{-\infty}^{\infty}-\int_{-\infty}^{\infty} \frac{df}{dx}(x) g(x)dx$$
Since the functions are compactly supported, end terms disappear, so
$$(f,\frac{dg}{dx})= -\int_{-\infty}^{\infty} \frac{df}{dx}(x) g(x)dx$$
Therefore
$$(f,\frac{dg}{dx})=(-\frac{df}{dx},g)$$
So on this space, the adjoint of ##\frac{d}{dx}## is ##-\frac{d}{dx}##.
However this is just on this space! If we assumed that there are boundary terms, it gets more complicated, if we are over complex numbers it gets more complicated. If functions aren't smooth, or even differentiable, it gets way more complicated.