You must be wondering, how are Diary of a Wimpy Kid and Saved by the Bell are in the same universe? Zack Morris and Greg Heffley are both the same person, but instead Zack is completely made up and only exists in Greg's diary.
Zack Morris is one of the most popular kids at Bayside High, but is he really? Doesn't it make you wonder how he can pause a situation at any moment in time just so everything goes his way? Well everything that happens he is imagining in his head while he is still in middle school as an unpopular kid with a weird best friend. (Rowley) Greg throughout the films/books is trying to be cool and be the popular kid that everyone cheers for and gets all the girls but seemingly fails in everything he does.
So what does Greg do? He creates his own imaginary world where he is older, cooler, and dates the hottest girl in school, which in Diary of a Wimpy Kid: Rodrick Rules is Holly Hills. Greg is so depressed with his life to the point where he creates an entirely new world in his diary. A place where he is best friends with the coolest people in school like A.C. Slater (Bryce Anderson) and can get rid of any person that is cooler than you or is always getting in your way. Hell even the principal Richard Belding follows him wherever he goes because he reminds him of his brother whom he envies so much.
This all takes place in the mind of a sociopath who will do anything to be popular; dress differently, act differently, or even create an imaginary world where he can do no wrong.