I am wondering why in IND-CPA security game, the adversary generates two random messages. What happens if for example 5 messages are generated? What would be the advantage for the adversary?
First things first: The adversary doesn't have to randomly pick messages, they can pick any messages they like, including heavily related ones.
Now as for why the adversary has to identify the message under $2$ instead of $n$ options.
- Two allows for 1-bit plaintexts. Suppose you had a scheme that is secure for all messages of 2 bits and longer, picking $n>2$ and enforcing same-length and distinctness would mean you have no statement about 1-bit messages.
- It's the most natural choice. 2 does the job, why pick a higher number?
- Two is perfectly sufficient to express the meaning of the messages. This would be to decide the which message was "picked" with all messages but one (so exactly one for $n=2$) being "not picked".
- Two makes the adversary the strongest and thus also our security model. By default the adversary has a 50% chance of getting the answer right, with other numbers this would be $1/n$.