Is there anything reliable known about who actually discovered the Chebyshev polynomials and what the motivation and circumstances were?

The reason why I am interested in knowing, is that I needed a solution for a variant of those polynomials: instead of all extrema having the same magnitude, I wanted to have them attain predefined values in a fixed order (I have found a solution for that problem, but involves a system of polynomial equations) and I wonder, whether the definition of the Chebyshev polynomials has been "guessed" or developed for a specific problem.

Edit:

at the request of @Hans, here is formal definition of my problem: given a sequence $(y_1,\ ...\ y_{n-1}), (y_{i+2}-y_{i+1})(y_{i+1}-y_i)<0$ of values, determine a polynomial $p(x)$ of degree $n$ and, $\ n$-$1$ abszissas $\ \xi_1 <,\ ...,\ <\xi_{n-1}$, so that $\ p(\xi_i)=y_i, p'(\xi_i)=0$

It should be noted that the polynomials that I am looking for, have no special properties, except for the predefined values in the extrema.
The leading coefficient can be set to $1$ and the constant term to $0$.

$$\ $$

**Construction of polynomials with predefined sequence of function-values for its local extrema:**

we can w.l.o.g. assume that the sought polynomial has leading coefficient $1$, a local extremum in the origin and, that all other local extrema are located at positive abszissas. Then polynomial is

$$p(x) =\frac{1}{n}\int x\prod_{i=2}^{n-1}(x-\xi_i)$$
and
$$p(\xi_i)=y_i$$
would a be system of polynomial equations for determining the $\xi_i$ and thus $p(x)$; the only problem being that, because of the symmetry, in the current formulation there is no control over the ordering of the $y(\xi_i)$.

That can however easily be fixed by defining $$\xi_k=\sum_{i=2}^{k}a_i^2$$
and solving the system of polynomial equations
$$p(\sum_{i=2}^{k}a_i^2)=y_k$$