While many animals lay eggs, only females have the biological capacity to do so. This is because females produce the egg cells (ova), which are essential for fertilization and development of an embryo.
There are some exceptions, like in the case of hermaphroditic animals, which have both male and female reproductive organs. In these cases, the individual can lay eggs, but they are still considered "female" for the purposes of egg laying.