Preflop
You are 16-17BB deep, so min-raising (rather than jamming) is definitely the right play.
Flop
Before betting this flop, the fundamental question to ask yourself is "am I happy, if I get called or raised"? And for me the answer to that is no. If you get raised, you are in a terrible spot, where you need to decide, if you want to stack off with an underpair to top pair. And even if he just call, the turn and river is not going to be fun for you. Most cards are going to be overcards, pair the board or complete draws. And if the opponent take any kind of aggressive action, you dont have a clear decision.
So for me I much prefer to play this hand defensively and start with a check. Checking can induce bluffs, and then you just make decisions based on the runout and his sizing. Or he check back, and now you are one step closer to showdown. The goal here should be to get to showdown as cheaply as possible, not to get value or "protect" your hand.
And this is something, that apply not just to this specific hand but to the situation in general. Medium strong made hands want to get to showdown cheaply. And we should C-bet the flop far less often out of position than in position. If BB had defended, then its much more ok to put out a small C-bet to sometimes take it down and more commonly keep control of the hand and be able to take a free card on the turn.
But someone calling from the field is supposed to be on a much stronger range, so if we look at the situation from a GTO perspective, our C-betting frequenzy goes way down. This is certainly not a board, you are supposed to C-bet 100% against an in position player. And whenever that is the case, medium strong made hands are mandatory checks.
Turn
As played a clear check.
River
As played another clear check. Its much to thin to bet for value here, when you lose to both a J and a 7. What are you trying to get called by here, like exactly A5s or something? Its a check and evaluate spot, and mostly I would look to check-call, since most of the draws missed. But depending on sizing and reads it could also be reasonable to check-fold.
Results
Him having AA is perhaps a little surpricing, but it does not matter. He could also have shown up with AJ, 87s, 64s and many other hands, that you lose to as well. The important point to take away is to be far more defensive, when you are out of position with a medium strong made hand like second pair.