I am removing two 15 amp breakers at the top left of my 40 space electric panel to be replaced with a 2 pole 30 amp breaker for backup generator. Can I just run two THHN #14 wires through a flexible conduit from an adjacent sub-feed panel and use common ground and neutral on first 40 space panel?
Ground yes. Neutral no.
You can do that with safety ground.
You cannot do that with neutral. Neutral needs to come over to the new panel that the hots are served out of.
This is easier to justify when using a type of metal conduit which itself is a valid grounding path, which is typically NOT the flexible kinds. EMT is a little more work but takes care of the grounds for you.
There are also good reasons to try to keep inter-panel conduits shorter than 24". Otherwise you are only allowed 4 circuits in them and must significantly derate the large feeder if there are other circuits in the pipe.
There is nothing wrong with using a service panel as a junction box to hold the wire-nuts that extend the circuit. Note this is a NEC interpretation, that may not work in Canada.