Why is the reactivity of primary alkyl halides with nucleophiles (SN2 mechanism) greater than secondary and tertiary alkyl halides?
The order of reactivity by substitution in these two reactions is difference because they have different mechanisms. The substitution of an alkyl halide by a strong nucleophile in a polar aprotic solvent is an SN2 mechanism. A $\ce{C-Nu}$ bond forms and a $\ce{C-X}$ bond breaks at the same time:

$$\ce{CH3CH2Br + NaOH -&gt;[\text{acetone}] Na}\bigg[\ce{CH3CH2(Br)(OH)}\bigg]^{^\ddagger_{-}}\ce{-&gt;CH3CH2OH +NaBr}$$

All else equal, the rates of these reactions are controlled by sterics on the alkyl halide, which control how well the nucleophile can react the $\ce{C-X}\ \sigma^*$ orbital. Thus:

$$\text{Methyl}&gt;1^\circ&gt;2^\circ&gt;&gt;3^\circ$$

The reactions of alcohols with hydrohalic acids follow a different mechanism (mostly). These reactions happen in a protic medium ($\ce{HX}$ is protic) with a poor leaving group ($\ce{OH}$), at least initially. These are conditions that favor the step-wise SN1 mechanism, where $\ce{C-X}$ bond breaking occurs before $\ce{C-Nu}$ bond forming. A carbocation is formed as a key intermediate. 

$$\ce{(CH3)3COH + HBr -&gt; [(CH3)3COH2+]Br- -&gt; [(CH3)3C+]Br- + H2O -&gt; (CH3)3CBr + H2O}$$

According to the Hammond postulate, the stability of this carbocation influences the rate of reaction. More stable carbocation intermediates suggest lower energy transition states for the formation of those carbocations, which implies lower activation energies and faster rates. Thus:

$$3^\circ&gt;2^\circ&gt;&gt;1^\circ,\text{Methyl}$$