The Bay Arena outfit have paid a nominal £2m transfer free for Gray, whose contract with the Foxes would have expired at the end of the season.
Leverkusen have already secured the signings of Timothy Fosu-Mensah from Manchester United and Jeremie Frimpong from Celtic in this transfer window.
Gray has spent much of his final season with Leicester observing proceedings from the sidelines as the former England u-21 international made just two appearances in all competitions in the first half of the campaign.
The 24-year-old moved to the King Power Stadium from Birmingham City in January 2016 and made 12 appearances as Leicester won the Premier League title under Claudio Ranieri.
"It's a great opportunity to gain new experience at a very interesting foreign club," Gray told Leverkusen's website.
"When the Bundesliga was the first big league to play again after the coronavirus break last year, the whole world looked over here. I like German football.
"I've seen Bayer 04 attack, move forward aggressively and technically, and dictate the game through possession. I fit in well here. I can and would like to develop further here and be successful with this attractive team."
Bayer sporting director Simon Rolfes said: "Demarai Gray is a tricky, very fast and penetrating winger who will give our attacking game an additional boost.
"He's capable of winning out in fast one-on-ones and bringing his team-mates into play. Thanks to his experience in the Premier League, Demarai is a player who can help us straight away."