Vertical alignment of node contents

Since you are already using minipages, you could use their alignment mechanisms. For example, it you want the text in the red box to be top aligned, use

\documentclass[a4paper]{article}
\usepackage{calc}
\usepackage{tikz}

\newlength{\boxH} \setlength{\boxH}{2cm}
\newlength{\boxW} \setlength{\boxW}{5cm}
\newlength{\boxM} \setlength{\boxM}{2mm}

\begin{document}
\begin{tikzpicture}
    \node[
        shape=rectangle, 
        fill=red, 
        inner sep=\boxM, 
        minimum width=\boxW, 
        minimum height=\boxH, 
        anchor=north west
    ] {%
        \begin{minipage}[t][\the\dimexpr\boxH-1.6em]{\boxW-2\boxM}%
        One line
        \end{minipage}%
    };
    \node[
        shape=rectangle, 
        fill=blue, 
        xshift=\boxW+\boxM,
        inner sep=\boxM, 
        minimum width=\boxW, 
        minimum height=\boxH, 
        anchor=north west
    ] {%
        \begin{minipage}{\boxW-2\boxM}%
        Two\\ lines
        \end{minipage}%
    };
\end{tikzpicture}
\end{document}

enter image description here


Since node's size is fixed and you know it's large enough to contain the text, you can use a label to place the text inside node's border selecting the convenient anchor:

\documentclass[a4paper]{article}
\usepackage{calc}
\usepackage{tikz}

\newlength{\boxH} \setlength{\boxH}{2cm}
\newlength{\boxW} \setlength{\boxW}{5cm}
\newlength{\boxM} \setlength{\boxM}{2mm}

\begin{document}
\begin{tikzpicture}
    \node[
        shape=rectangle, 
        fill=red, 
        inner sep=\boxM, 
        minimum width=\boxW, 
        minimum height=\boxH, 
        anchor=north west,
        label={[anchor=north west]north west:One line}
    ] {};
    \node[
        shape=rectangle, 
        fill=blue, 
        xshift=\boxW+\boxM,
        inner sep=\boxM, 
        minimum width=\boxW, 
        minimum height=\boxH, 
        anchor=north west,
        label={[anchor=south, align=left]south:{Two\\ longer lines}}
    ] {};
\end{tikzpicture}
\end{document}

enter image description here