This is a tough one. Wayne Gretzky played in the NHL from 1979 to 1999, way before you were born. Connor McDavid, though, was only drafted to the NHL in 2015. So, while we can look at Gretzky's career as a whole, no one knows what the future holds for McDavid. Also, it's worth remembering that to even play in the NHL requires a lot of talent. With this in mind, neither Gretzky or McDavid is anything to shake a (hockey) stick at!
There are lots of ways to measure how good a hockey player is, such as goals, assists, and points. Let's talk about goals scored. To start, in the two years before being drafted into the NHL, Gretzky was out-scoring McDavid.
At the time of this post in April 2022, McDavid has played seven seasons in the NHL so far. In Gretzky's first seven seasons, he scored 481 goals. On the other hand, McDavid scored "only" 232 goals in the same amount of time.
Over the course of his career, Wayne Gretzky scored 894 goals. That is going to be very, very difficult to match and even harder to beat. Some hockey fans argue that Gretzky's era was higher-scoring, and can't be compared to present-day hockey. But even in his time Gretzky went unrivalled, except maybe by Bobby Orr. Speaking of Orr, many hold the opinion that he, and not Gretzky, is the best NHL player of all time. But that is a wonder for another day...
Hockey as a game is changing all the time. For example, NHL players have been wearing helmets since 1979, which was not that long ago! Changes over the rest of McDavid's career might make it easier – or harder – for him to score as many goals as Gretzky. Only time will tell!