It's an iterative process. There's a few methodologies for it (e.g. lean startup). You build something, ask users what they think, fix it according to feedback. At some point, they'll ask you when they can buy it, which is when it becomes a business. Then business is just finding similar people who would buy the same thing or a variation of it.
Doing it in the wrong order (selling something, getting customers, then building a product around it) usually results in a bad thing, where you end up giving out $1 of value for $0.80.
There's a lot more details here: https://startupclass.samaltman.com/