Difference between sampling rate and baud rate and their relation to channel capacity
First let's estabish the context.
Let's say you want to transmit a sequence of numbers $\lbrace a_k \rbrace_{k=1}^{N} = a_1, a_2, \ldots$ Using PAM, this sequence is transmitted with the signal $$s(t) = \sum_{k=1}^N a_k p(t-kT_p),$$ where the pulses $p(t-kT_p)$ form an orthonormal set, that is, $$\int_{-\infty}^\infty p(t) p(t) \text{d}t = 1$$ (which implies that the pulse $p(t)$ has unit energy) and $$\int_{-\infty}^\infty p(t-jT_p) p(t-kT_p) \text{d}t = 0$$ whenever $k \neq j$, which allows the receiver to recover the transmitted sequence using a correlator or a matched filter.
Second, let's see what Nyquist and Shannon say.
First of all, the pulses in $s(t)$ are transmitted at a rate $R_p = 1/T_p$. This is called the &quot;pulse rate&quot; or the &quot;symbol rate&quot;. You want $T_p$ to be short, to transmit information faster. However, this increases the bandwidth $B$ of $s(t)$. The relationship is $$B = \alpha \frac{R_p}{2} = \alpha \frac{1}{2T_p}.$$
The value of $\alpha$ is the &quot;spectral efficiency&quot; of the pulse $p(t)$. The minimum possible value is $\alpha=1$, when $p(t)$ is a sinc pulse. In this case, $B=R_p/2$ or $R_p=2B$. This is what it means to say that &quot;$2B$ pieces of information can be transmitted per Hz of bandwidth available.&quot;
If this was all there was to it, then an infinite amount of information could be transmitted in any amount of time. All one has to do is let the $a_k$ be arbitrary real numbers, with infinite precision. Even if one is constrained to choose from a constellation, such as $M$-QAM, one could choose $M$ to be as large as needed.
In practice, however, noise, distortion, and other imperfections prevent transmission of $a_k$ numbers with infinite precision. The simplest model of a communications system assumes that the received signal $r(t)$ is corrupted with white Gaussian noise with power spectral density $N_0/2$: $$r(t) = s(t) + n(t).$$
Transmission under the effects of noise restrict the choice of symbols $a_k$: they must belong to a finite set whose elements cannot be easily mistaken for one another. For example, if we constrain the symbols to take values either $-0.5$ or $0.5$, and the noise magnitude is very unlikely to be larger than $0.5$, then transmission can be done very reliably; however, we pay a price in two different ways:

Power: since the symbol amplitudes cannot be made too small, a minimum amount of power is required;
Rate: since we're limited in the choice of symbol amplitudes, we can't transmit as fast as we wish.

In terms of a $M$-QAM constellation, the consequence is that we can't increase $M$ arbitrarily; when $M$ is made too large, the system cannot transmit information reliably any more.
This is where Shannon comes in. He was interested in the relationship between the entropy of the information source that produces the transmitted sequences $\lbrace a_k \rbrace$, the bandwidth, and the signal to noise ratio in the received signal. He definitely did not say that the maximum bit rate is twice the bandwidth; rather, the maximum bit rate is given by the bandwidth, the SNR, and some specific properties of the sequence $\lbrace a_k \rbrace$. The study of these properties is known as &quot;coding theory&quot;.
Finally: is it a coincidence that a signal with bandwidth $B$ must be sampled at rate $2B$, and that a signal with bandwidth $B$ can transmit symbols at rate $2B$? It is indeed not a coincidence. You want to transmit symbols at rate $R_p$; in other words, you want a signal that has specific amplitudes at times $kT_p$:

Think of these amplitudes as signal samples:

The blue signal is the transmitted signal $s(t)$, and since its samples have rate $R_p$, then it has bandwidth $B=R_p/2$.