You should get Sonic mania most definitely because... MANIA, but Sonic generations doesn't have that much replayability and in general isn't really that good (especially with it's lack of a story/plot) and it can't really be modded like Sonic mania, now I would actually suggest something like Sonic unleashed but... Games like srb2 do what modern Sonic games don't in terms of how fun they are and they're usually entirely free to download and play so you should get those.
Here are some fan game suggestions-
1. SRB2 (obviously)
2. Sonic GT (and before you ask no there is nothing dragon Ball in it)
3. Sonic-P06 (first - I'm sorry if I got the name wrong, second - it's a better version of Sonic 06 and generally does what Sonic 06 doesn't do which is not be a buggy peice of shit)
I would say more but I forgot the names of the good Sonic fan games I've seen over the years so I just suggest to do some research on good Sonic 3D games on YouTube no matter how cringy the videos look because it's better in the long run.
But that's just my opinion so my last note is that Sonic generations is kinda good but not by a lot and Sonic mania is... Well... Sonic mania so get Sonic mania but think extra hard about getting Sonic generations.
Both are really good games. It's mostly going to depend on your preference. If you want to experience the Boost formula, Generations is definitely the best option out of any Sonic game. If you want the Classic experience, play Mania. Generations is a good middle ground since it also has Classic Sonic and it's events explain how Mania comes about in the timeline (By making an alternate timeline/dimension)