The following code fails with the error

! LaTeX Error: Command \mybox already defined.
Or name \end... illegal, see p.192 of the manual.

\usepackage[most]{tcolorbox}

\newtcolorbox{mybox}[2][]{%
colback=bg,
colframe=blue!75!black,
fonttitle=\bfseries,
coltitle=blue!75!black,
colbacktitle=bg,
enhanced,
attach boxed title to top left={yshift=-1.2mm, xshift=2mm},
title=#2,
#1}

%--------------------

\newcommand{\mybox}[1]{
\setlength{\fboxsep}{7pt}
\begin{center}
\end{center}}

%--------------------


• You can have both a tcolorbox mybox and a command \mybox. Choose another name. – Ulrike Fischer Dec 15 '17 at 11:41
• Sorry I meant "you can't" not "you can". – Ulrike Fischer Dec 15 '17 at 11:55
• In case you weren't aware, and you are confused why \mybox is already defined: When you write \begin{mybox} LaTeX translates that into \mybox with some checking around it. Therefore, when you created the environment mybox as a new tcolorbox, internally, that defined the command \mybox :) – Alex Recuenco Dec 15 '17 at 12:42

You just replace \mybox by for example \cadre us follows:

    \usepackage[most]{tcolorbox}

\newtcolorbox{mybox}[2][]{%
colback=bg,
colframe=blue!75!black,
fonttitle=\bfseries,
coltitle=blue!75!black,
colbacktitle=bg,
enhanced,
attach boxed title to top left={yshift=-1.2mm, xshift=2mm},
title=#2,
#1}

%--------------------