A capsule is a type of botanical fruit. The name is very fitting as they are like capsules which split open to spread the seeds therein. It is reminiscent of a caryopsis in that it comprises multiple locules. Some capsules superficially look like a caryopsis when cut horizontally due to the locules' arrangement. However, each locule is very similar to a legume. They typically dry out, split open, and spread the seeds inside.
The term does not have a separate culinary meaning. Although, it does have a generic meaning of just a small container.
Many capsules are not eaten. Some like durians are eaten as fruits before they're entirely dry. Many others are eaten as beans, and therefore vegetables, again very similarly to legumes.