I know what a segfault is: for example,
char arr[10];
arr[11]='n';
But why call it a segfault? Is it related to the segments of memory that get pushed onto the stack?
And why is it commonly defined as:
A segfault is an error where the program tries to access unallocated memory or tries to access memory that it does not have permission to access.
But where does the segmentation in segmentation fault come from?
It is called a "Segmentation Fault" for purely historical reasons. Today it is often not a "segment" and often not a "fault".
Memory protection can be found in virtually all modern operating systems for anything larger than a tiny micro-controller, and it has been around for quite a while: mainframe computers have had it since the sixties. (See Wikipedia: Memory protection.)
In operating systems with memory protection, a process is allowed to access only certain areas of memory. Also, it may be allowed to access certain areas only for reading, but not for writing.
If a process attempts to access memory it is not allowed to, or if it tries to write when it is only allowed to read, the CPU detects this invalid memory access, and generates some kind of "interrupt" so that the operating system can take over and terminate the misbehaving process. (See Wikipedia: Interrupt)
Apparently, some early computer that was targeted by some early version of Unix (Probably the GE 645) used a memory management mechanism in which those "areas of memory" were called "segments", (see Wikipedia: Memory segmentation) and that interrupt was called a "fault". (The Wikipedia page for: Fault (Computing) redirects to "Interrupt".)
So, on that ancient system, an invalid memory access would cause a "Segmentation fault." (See Wikipedia: Segmentation Fault)
The first programmer who generated a human-readable error message from such an error suffered from complete inability to think in abstract terms, so they made the error message refer to this extremely technical and highly esoteric concept.
Computer geeks generally do not mind; non-technical users freak out.
(The error message was intended to spell out exactly what was happening. Anyone who could possibly see that error message was presumed to be another computer geek.)