You have two unwanted spaces in your definition:
\newcommand{\testcommand}[1]{% <--- here
\includegraphics[]{pictures/#1.jpeg}% <--- here
}
An endline always counts as a space. On the other hand, spaces (and tabs) are ignored at the beginning of a line.
If you also type in
\testcommand{figure
}
you add a further space.
The two unwanted space in your definition only affect spacing in the document, whereas the one in the call affects the file name, because it's the same as if you called
\textcommand{figure }
But the space doesn't come from the space or tab before }, as you seem to believe, rather from the endline after figure.
Since TeX is a typesetting system, it's obviously sensitive to spaces, because they're an important ingredient for printed text.
Important references:
What is the use of percent signs (%) at the end of lines? (Why is my macro creating extra space?)
When is it harmful to add percent character at end of lines in a \newcommand, or similar