The main problem is that xstring
tries full expansion of the arguments to its commands.
Here's how to do it with expl3
.
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\typesetlist}{m +O{} +m +O{}}
{
#2 % before
\exp_args:NV \clist_use:nn { #1 } { #3 }
#4
}
\ExplSyntaxOff
\newcommand{\listprovidedbytheauthor}{Test1,\textit{Test2},{\bfseries Test3},\LaTeX,Test4}
\begin{document}
\typesetlist{\listprovidedbytheauthor}[\begin{flushleft}]{\\}[\end{flushleft}]
\typesetlist{\listprovidedbytheauthor}[\noindent Keywords: ]{, }
\end{document}

As you see, braces around the items are removed, which can have bad consequences in case wrong input such as \bfseries Test3
is used (with or without braces). To be safe from such input errors, you can use a two-step approach: we split the list at commas and then surround each item by braces.
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\typesetlist}{m +O{} +m +O{}}
{
#2 % before
\clem_list_typeset:Vn #1 { #3 }
#4
}
\seq_new:N \l__clem_typeset_list_in_seq
\seq_new:N \l__clem_typeset_list_out_seq
\cs_new_protected:Nn \clem_list_typeset:nn
{
\seq_set_from_clist:Nn \l__clem_typeset_list_in_seq { #1 }
\seq_set_map:NNn \l__clem_typeset_list_out_seq \l__clem_typeset_list_in_seq { {##1} }
\seq_use:Nn \l__clem_typeset_list_out_seq { #2 }
}
\cs_generate_variant:Nn \clem_list_typeset:nn { V }
\ExplSyntaxOff
\newcommand{\listprovidedbytheauthor}{Test1,\textit{Test2},{\bfseries Test3},\LaTeX,Test4}
\begin{document}
\typesetlist{\listprovidedbytheauthor}[\begin{flushleft}]{\\}[\end{flushleft}]
\typesetlist{\listprovidedbytheauthor}[\noindent Keywords: ]{, }
\end{document}
