Some people act so shocked when you tell them you did something because it would make you richer and not because an angel came to you in a dream and whispered in your ear to save the disenfranchised underclass (and all the cats) by writing code, or whatever's the current faux na pas reason to pursue a vocation these days.
Answering why you picked this particular path to high income is more interesting of an answer to the person asking and carries the conversation. Did your parents do it, did you have a professor that captured your attention, did you just google “easiest job to make a lot of money?” and pick the first one?
Someone asking wants to understand how and why you make decisions. What motives you. Etc. It’s the XY problem and from the other person’s perspective, you’re answering the wrong one.
This is too simplistic. Someone might ask that for a million reasons. Also, you will be judged not only by your answer. Being so direct might show you are not on autopilot in the conversation, your humour or that you only care about money, depending on a lot of other factors. It might make one more memorable as well. I personally would read it as light humour, unless it is accompanied by a dead eyes stare.
Take for instance someone telling you about their career. "I'm a software developer".
You can express interest with a response like "Oh, thats cool, what made you go into that line of work?" but thats a very generic, shallow response.
If you know a thing or two about software, for example, you can ask more interesting questions that show your interest in them, and your knowledge of the space. "Woh cool, how is AI coding impacting your life?"
Suddenly, it seems like you're much more interesting yourself, AND you're interested in them.
The tricky part nowadays is everyone has very niche interests. It's harder than ever to really have a breadth of knowledge that is broadly applicable. This was easier before the internet, before travel, before telecommunication. When your community was your community and news traveled slowly, it was a lot easier to learn about what impacted others.