Biologists aren't the people who decided what an "apple" is, the general population of users of language are.
You could try back-create a definition that is biologically relevant based on descent, for example "fruit of plants in the genus Malus", but that would include a lot of apples that aren't really apples the way English speakers in general use the word.
You could limit it to just fruits of Malus domestica, but that probably wouldn't work great, either, because there are several fruits outside that species that a typical English speaker would still call "apple".
A relevant botanical definition is that an apple is a pome:
A pome is an accessory fruit composed of one or more carpels surrounded by accessory tissue. The accessory tissue is interpreted by some specialists as an extension of the receptacle and is then referred to as "fruit cortex",[2] and by others as a fused hypanthium (floral cup).[2]
...but many botanical fruits of this type are not "apples" in the English use of the word, such as pears or hawthorn.
It happens a lot in language that biology and culinary or other language issues conflict, for example the "is a tomato a fruit?" debate. There are also other popular language classification quirks that people debate on the internet like "is a hotdog a sandwich?". These are all questions about language and how language is used, not about any biological or other scientific essence of things.
Biologically speaking, your brain learning these things is a lot like how an artificial neural network is trained to, say, identify road signs. Just like when you complete "Captcha" tasks to "prove" you are a human when acting online like "select all images with a stop sign in them", and this training data is sent to an AI algorithm, as a developing human the adults around you will hand you things and say "apple". You then assign a little slice of all the features you perceive and associate those with the concept "apple" in your brain. They're also correct you and say "no, that's an orange" if you expand your definition beyond "apple", and you'll learn to break associations between those orange-specific perceptions. In this way, the things you call "apple" are just the things that other people call apple, and that's how we can use language to communicate with each other: as long as we all mean roughly the same thing when we say "apple", it's a useful concept, even if it doesn't make sense biologically.