Since the Sam Raimi Spider-Man movies of the early 2000s I think there have been at least three different actors for the character? What was the reason for this?
First and foremost, Spider-Man is traditionally seen as a young hero. He started his career as a high school student, and while the comic book version soon moved on to college, just about every incarnation of the character places him in his teens or early twenties.
Tobey Maguire was already in his mid-20s when he filmed the first installment in his Spider-Man trilogy, where he was still supposed to be in high school. By the time Spider-Man 3 premiered, he was in his 30s. Presenting him as a young, inexperienced hero for a fourth attempt would have bordered on the ludicrous.
But even if age were not a concern, continuing the series with the same actor would require the consent of both the actor and the studio. In Tobey Maguire's case, it didn't appear either side was interested in pursuing a fourth installment of his franchise. Exactly what happened seems unclear. You can find some reports that say both Sam Raimi and Maguire quit, while others insist Sony canned the project. Regardless of what happened in this specific case, actors ultimately get bored of roles, and studios frequently update franchises to bring in fresh audiences.
Consider the most recent installments, Spider-Man: Homecoming and the affiliated Avengers movies. There Peter Parker is portrayed as a neophyte apprentice to Tony Stark. That clearly would not work with an actor in his 40s. So you've got two choices: either change the character, the script, and the fundamental premises of the movies, or change the actor. The second option is not only significantly easier, it is eventually inevitable.