Einstein introduced the cosmological constant lambda Λ in an attempt to produce a steady state model of the universe -- in his view the most elegant solution to the problem of our existence was a universe infinite in age.
Later on when the Big Bang was firmly established it came to be seen as an unnecessary mistake.
In a twist of fate, when we discovered the accelerating expansion of the universe in the 90s -- also known as dark energy -- Einstein's cosmological constant Λ was the perfect place to 'absorb' it.