The Harry Potter series had already enjoyed several years of warm reception in book form by the time The Sorcerer's Stone movie was released in 2001, but the cinematic series propelled the Wizarding World mythology's popularity to new heights. Before that happened, though, there was a lot of time spent finding the right actors to play these roles (as is the case with many blockbusters), and the crew was very picky about who they wanted. For instance, comedy legend Robin Williams was keen on appearing in the movie as Hagrid, but he was turned down because he wasn't British.
While discussing the process of how Daniel Radcliffe ended up scoring the highly coveted Harry Potter role all those years ago, casting director Janet Hirshenson told The Huffington Post that Robin Williams had called to see if he could star in Harry Potter and the Sorcerer's Stone, but director Christopher Columbus had to follow their British actors-only rule. As Hirshenson put it:
Robin [Williams] had called [director Chris Columbus] because he really wanted to be in the movie, but it was a British-only edict, and once he said no to Robin, he wasn't going to say yes to anybody else, that's for sure. It couldn't be.
Evidently Robin Williams' lengthy acting resume even at that time wasn't enough to guarantee him a spot in the Harry Potter universe. As we all know, the Hagrid role eventually went to Robbie Coltrane, who was best known before then from GoldenEye, The World Is Not Enough and the TV series Cracker. If it's any consolation, J.K. Rowling has said before that Coltrane was her first choice to play Hagrid, and her wish was granted. That should bode well for whoever she has in mind for young Albus Dumbledore in Fantastic Beasts and Where to Find Them 2. While it's hard to imagine anyone other than Coltrane playing Hagrid in the eight Harry Potter movies, it would have been fascinating to at least watch an audition tape of Williams channeling the half-giant.
While there were exceptions to the British-only rule that the Harry Potter crew decreed, like with the foreign magical students who appeared in The Goblet of Fire, basically anyone remotely connected to Hogwarts and the UK Wizarding World had to be played by someone from that same area, which makes sense. Ironically, though, that rule didn't extend to director Christopher Columbus' daughter, Eleanor, who played Susan Bones in the first two Harry Potter movies.