Obviously the software doesnt have all the possible combinations stored. It generates the 24 words and keypair using certain algorithm.
No.
The software chooses 24 words (out of a set of 2048 words as specified in BIP39 [1]) randomly(!).
Thats 2.96427748 * 1079 different seeds. Way more than someone could ever create (by far).
The software chooses 24 words. This seed is used to derive the private key (or multiple private keys..).
To be more accurate:
Together with BIP44 [2] this basically creates a one-way-function. This makes it impossible to get the mnemonic seed out of a private key.
The public key is derived from the private key using ECDSA [3].
And the address is a RIPEMD160 hash of a SHA256 hash of the public key (hash functions are one-way-functions) [4]
[1] https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
[2] https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
[3] https://de.wikipedia.org/wiki/Elliptic_Curve_DSA
[4] https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses