This is a type of snakehead fungus, also called snake bubble or snake mushroom. There are different opinions on whether the snakehead fungus is edible. Some places say it can be eaten, while others think it is poisonous and cannot be eaten.
When it matures, its head will emit a smell, which can attract insects and facilitate the spread of spores.
According to some Chinese medicine books, it is poisonous, but it is indeed edible in some places. It may be that the species is different, or there may be ways to reduce toxicity. In short, if you are not sure and don't know how to do it, then don't eat it. There are many fungi in nature that are poisonous and can kill people.