Wollerton, 21, becomes the club's 10th summer signing for manager Tom Shaw.
The former Leeds United youngster has featured for Darlington and Barnsley, before joining York City in September 2020.
On the signing, Shaw said: "He is a bright, intelligent young man who carries himself really well and I think we can definitely help him in the next stage of his footballing journey.
"He had good options in the same division and opportunities to join squads higher up the pyramid but knowing the reputation of our football club and understanding the way we will be working; Alex has chosen Gainsborough Trinity and I am confident the supporters will enjoy his all-action displays."
On his move, Wollerton added: "I’m delighted to have signed. The gaffer and the players have made me feel really welcome. Now I just can’t wait to get playing in front of the fans."
Keep up-to-date with our exclusive email newsletters.
Subscribe