Bonsai is the art of tediously training what would be standard sized trees to grow in a miniaturized fashion while maintaining the shape and basic structure of a full sized tree. They are not different tree species. This is done by restricting their growth by keeping them in containers and shaping them via pruning. Keeping them miniaturized and properly shaped also involves some root trimming.
The excessive pruning and root trimming naturally puts the tree in a lot of stress so adding the burden of adding fruit bearing is too much for many trees to handle. That's not to say it can't be done,- no Contrierre Pierre, it can and has been done very successfully so far as aesthetic appeal is concerned. So far as producing a hefty harvest sorry - you can't have your cake and eat it too - but you can still get modest yields of tasty fruit off Bonsai Trees that create awesome eye candy either indoors or out.
The best fruits to choose for Bonsai are small fruits. You wouldn't expect a standard apple that weighs 1/3 of a pound to grow on a branch that weighs about half that, it's basic physics. You can however get an edible crab apple that weighs 3 - 4 ounces or even a berry that weighs less than that to grow just fine on a Bonsai tree.
So far as apples are concerned, they are in the genus Malus which includes both apples and crab apples, any fruit that is two inches in diameter or less, it is termed a crab apple. larger than two inches, it is an apple. So basically crab apples are miniature apples and many varieties are very tasty. Calloway, Harvest Gold, Dolgo are a few of the edible crab apples that lend themselves well to Bonsai.
Fig trees that produce basically very small pear like fruits aka figs are great for bonsai novices. Many varieties will bear fruit in the spring and again in early fall. Cherries will also work well as bonsai trees.
Coffee Trees make excellent bonsai trees, and even a good yard plant if you live in a warm enough zone. Not only does it have its aesthetic appeal, but it also produces 2 valuable crops. The coffee bean as well as the super fruit that encases the coffee bean. The red to purple fruits that encase coffee beans are referred to as a cherry, it is a stone fruit and the so called 'beans' are actually its pits.
Citrus trees that work well as Bonsai are generally dwarf varieties, my personal favorite is the Kumquat. Kumquats are a tiny citrus, similar to oranges in taste but oblong and about the size of a cocktail olive.
Kumquats grow in cooler regions where other Oranges and other citrus will not. See; Kumquats as Bonsai Trees
Other dwarf citrus such as Meyer lemon, Kieffer lime and Rangpur Lime also work well. Calamondin orange trees have very attractive blossoms and produce fruit in all seasons under the proper conditions.
The fruit of Calamondin orange however takes a very long time to ripen and in my humble opinion doesn't really taste all that great.