Almost all - if not all - smart cards have a true random number generator (TRNG) on it. Most often the TRNG depends on thermal noise or clock drift, but other entropy sources are possible. A more technical evaluation of this can be found e.g. here ("Sources of Randomness in Digital Devices
and Their Testability by Viktor Fischer"). For a longer set of options, have a look at the "hardware random number generator page on Wikipedia. Which one is implemented depends on the specific model of smart card that you are using. It may be hard to find out because commonly this kind of info is hidden in technical documentation that you may not have access to.
The entropy generated by such a TRNG are commonly whitened and / or fed into a CSPRNG before they are used by the OS, applications and / or libraries on the smart card. Usually the RNG's are validated against FIPS 140-2 or AIS31 (German BSI), possibly as part of a Common Criteria certification. The certification of the TRNG / CSPRNG is commonly mentioned in the data sheets of the specific processors and the certification may indicate the precise TRNG that is used.
In your case undoubtedly either a whitened TRNG or a CSPRNG seeded from that TRNG is used for generating two primes of half the key size for your key pair. This requires a lot of randomness. How much entropy and randomness is used depends on the implementation and possibly how much luck the implementation has on finding the primes.
Note that Linux will nowadays also use randomness on chips that support the RDRAND implementation specified by Intel and copied under their agreement by AMD for their Ryzen chips. Because not everybody trusts this kind of random source it is common to mix in entropy from other sources. Other CPU's such as VIA's Eden processors have sported other chip based solutions. Motherboards often contain a TPM chip as well, which is commonly based on a Smart Card design, and sports the same kind of hardware TRNG.