The four you mentioned:
Sheldon has restraining orders from his heroes Leonard Nimoy, Carl
Sagan, and Stan Lee, as well as television scientist Bill Nye.
These are mentioned in the episodes The Excelsior Acquisition (Stan Lee), The Vacation Solution (Carl Sagan), The Bath Item Gift Hypothesis (Leonard Nimoy), and The Proton Displacement (Bill Nye).
This is confirmed by this specialized entry on bigbangtheory.fandom.com.
Although not mentioned explicitly, plus one from Zachary Quinto, as implied in S10E16, The Allowance Evaporation (see below for proof).
But there could follow more, of course
The reasons for the other three restraining orders - besides the ones you mentioned - are not all made clear.
The only time he mentions Carl Sagan's, is in The Vacation Solution, when he walks in on Amy with freshly washed glassware and tells her
Here you go! This is now the only lab with glassware washed by a man
with two doctorates and a restraining order signed by Carl Sagan.
And the only time Nimoy's is mentioned, is in The Excelsior's Acquisition:
Sheldon: I’ll tell you where I’ve been. You boys may have had gelato
with Stan Lee and gotten autographed comics, but I saw the inside of
his house and got an autographed application for a restraining order.
Howard: Sweet.
Sheldon: Plus, I get to hang out with him again at the hearing. This
is going to look great hanging next to my restraining order from
Leonard Nimoy.
Zachary Quinto's restraining order, however, is due to Sheldon following him into the bathroom:
Amy: Sheldon, there’s a difference between greeting a friend and following a celebrity into a bathroom.
Sheldon: If the judge couldn’t explain it to me, I don’t see how you will. If you think [saying hi to seeing someone you know in a public space is] more fun than talking to Zachary Quinto through a stall door, you’re crazy.
See the episode's script for more details
It probably - and this is pure conjecture - involves his enthusiasm concerning these idols of him mixed with his social ineptitude getting the better hand of him.
Sources:
https://en.wikipedia.org/wiki/Sheldon_Cooper#Personality
https://bigbangtheory.fandom.com/wiki/Leonard_Nimoy
https://bigbangtheory.fandom.com/wiki/The_Vacation_Solution
https://bigbangtheory.fandom.com/wiki/The_Allowance_Evaporation#Trivia