I think that RAW is unclear about it, so I'll present my reading on it, from a few different points of view. By the end, I present my point on a more flavorish style, rather than mechanical/RAW.
RAW
Portent states
You can replace any attack roll, saving throw, or ability check made by you or a creature that you can see with one of these foretelling rolls. You must choose to do so before the roll, and you can replace a roll in this way only once per turn.
Lucky
Whenever you make an attack roll, an ability check, or a saving throw, you can spend one luck point to roll an additional d20. You can choose to spend one of your luck points after you roll the die, but before the outcome is determined. You choose which of the d20s is used for the attack roll, ability check, or saving throw.
I will, without loss of generality, assume we are talking about attack rolls (so I don't need to say "attack roll, saving throw or ability check" and instead I can just say "attack roll", I'm THAT lazy).
One way to read it is that the "attack roll" is replaced by a "foretelling roll". As Lucky doesn't state "when you make a foretelling roll", Lucky can't be applied after Portent. This reading has further implications on many interactions that are probably not intended, mainly with any feature written as "When you make an attack roll". This is focused on the bold emphasis. It is, however, an interpretation of what's written.
Other way to read it, based on the italic emphasis, is that the Portent replaces the roll and actually you don't roll any die when making the attack roll, so, again, the trigger after you roll the die doesn't happen.
There is also the reading presented by Grosscol, in which Lucky only allows you to roll an additional dice and then choose which one is the roll, while Portent replaces the roll as a whole. This is consistent with the Adv/Disadv ruling you mention. In this reading, the process would be resolved similar to the Adv/Disadv:
- The wizard declares he is using Portent before the roll. For example, he declares an attack and uses his 18 roll.
- The wizard rolls the attack roll die. Following the example, say he gets a 19. The enemy uses the Lucky feat, forcing the Wizard to roll an additional attack roll die, in which he gets a 2.
- The Lucky feat resolves. The enemy decides the result is a roll of 2.
- The 2 is replaced by the 18.
Addressing the Portent then Lucky scenario mentioned by NautArch
Maybe this is a result from me playing too much Yu-Gi-Oh!, but I read a trigger "Whenever X, Y" as "Y has to happen immediately after X". This means the following order
- The wizard declares he is using Portent before the roll. For example, he declares an attack and uses his 18 roll.
- The wizard rolls the attack roll die. Following the example, say he gets a 2.
- Portent resolves. The 2 is replaced by the 18.
- Ene Enemy chooses to use Lucky. The Wizard rolls an 8.
- The Lucky feat resolves. The enemy decides the result is the roll of 8.
can't be done because the "When an attack roll is made against you" is not the "last thing" that has happened - the portent resolving is. I.e., Lucky had to be activated right after step 2, and step 3 happening makes it miss the timing for its trigger.
So, to sum it up, my reading of RAW is Portent overrides Lucky. My reasoning to disagree with NautArch is simply on how I read the "When X..." trigger. If you read it as "any time after the roll, but before the outcome" (rather than "immediately after the roll"), then the order presented in this last subsection is valid.
If you want to let both orders to be valid
You can rule Portent and Lucky as simultaneous effects (both happen "When you make an attack roll...", even if the meta instant (before/after rolling a dice) is not the same, the "in-game" moment they happen is essentially the same) and rule it as XGE suggests
Most effects in the game happen in succession, following an order set by the rules or the DM. In rare cases, effects can happen at the same time, especially at the start or end of a creature’s turn. If two or more things happen at the same time on a character or monster’s turn, the person at the game table — whether player or DM — who controls that creature decides the order in which those things happen. For example, if two effects occur at the end of a player character’s turn, the player decides which of the two effects happens first.
This might be a little stretching, but I think it has its merits.
Rules as Fun/Flavor
Portent is basically "The Wizard knows what is going to happen", something like knowing destiny.
Lucky is being incredibly... lucky.
Is being lucky enough to override destiny?
I honestly think it isn't. My reasoning is simple: while the luck might fail (even if you roll an additional d20, you can still get a worse result and have to stick with the initial one), destiny is always right.
But I don't see any reason to not rule it as "He is so lucky that he defies destiny sometimes, making even the best fortunetellers drop their jaws".