How is Merkle path derived or calculated? How is Merkle path calculated? I am looking for a detailed algorithm rather than a quick one liner for this so I can implement it.

Note that this is not the same as computing Merkle root or building Merkle tree. Also not asking why Merkle path is needed. I did not find any info on this site going over the algorithm for deriving Merkle path.
Given a merkle tree and a transaction that is in that tree, to find the path from the root to that transaction, first hash the transaction. Then find the leaf node in the merkle tree with that hash. Add that node to a list. Take the parent of that node. Add that node to the list. Take it's parent, add it to the list. So on and so forth until you reach the merkle root (which can be identified as the node with no parent). The list of nodes is the path.

If you also need the other node each node was hashed with so you can construct a merkle proof, for every node, when you go to it's parent node, see which side the node you came from was on and record it. And then record the hash of the node on the other side and the side it was on.