How can I transform a random variable so that it's distribution matches that of a reference variable?
I have two vectors of randomly sampled values, each from a separate distribution. I don't know which family either belongs to.
The chart below shows their respective distribution:


Here's something you can try as a first approximation: focus on using a linear transformation, and aim for the goal of getting the two variables to have the same mean and variance. Call the two random variables $X, Y$ and their respective means / standard deviations $\mu_X, \mu_Y$ and $\sigma_X, \sigma_Y$.
We want to find coefficients $a, b$ such that $a X + b \stackrel{d}{=} Y$; consequently, we will have $\mu_X = \mu_Y$ and $\sigma_X = \sigma_Y$. The standard deviation of the variable $a X + b$ is $a \sigma_X$; since we want this to be equal to $\sigma_Y$, we set $a \sigma_X = \sigma_Y \implies a = \frac{\sigma_Y}{\sigma_X}$. Similarly, the mean of $a X + b$ is $a \mu_X + b$; we want this to be equal to $\mu_Y$, and we already know $a$, so we can solve for $b$.
Since you don't have access to the parameter coefficients $\mu$ or $\sigma$ for either variable, you can use their estimators $\overline x, \overline y, s_X, s_Y$ as an approximation.
Note that this transformation won't be perfect. No easy transformation will smooth out those jagged edges on the blue density to make them smoothly match the red one. But, it's a start. Does this help?