C-x C-q runs the command read-only-mode (found in global-map), which is an interactive compiled Lisp function in ‘simple.el’.
It is bound to C-x C-q.
(read-only-mode &optional ARG)
Change whether the current buffer is read-only. With prefix argument ARG, make the buffer read-only if ARG is positive, otherwise make it writable. If buffer is read-only and ‘view-read-only’ is non-nil, enter view mode.