The median nerve is a nerve in humans and other animals in the upper limb. It is one of the five main nerves originating from the brachial plexus. The median nerve originates from the lateral and medial cords of the brachial plexus, and has contributions from ventral roots of C5-C7 (lateral cord) and C8 and T1 (medial cord).The median nerve is the only nerve that passes through the carpal tunnel. Carpal tunnel syndrome is the disability that results from the median nerve being pressed in the carpal tunnel. Structure
The median nerve arises from the branches from lateral and medial cords of the brachial plexus, courses through the anterior part of arm, forearm, and hand, and terminates by supplying the muscles of the hand. Arm
After receiving inputs from both the lateral and medial cords of the brachial plexus, the median nerve enters the arm from the axilla at the inferior margin of the teres major muscle. It then passes vertically down and courses lateral to the brachial artery between biceps brachii (above) and brachialis (below). At first, it is lateral to the artery and lies anterior to the shoulder joint; it then crosses anteriorly to run medial to the artery in the distal arm and into the cubital fossa. Inside the cubital fossa, the median nerve passes medial to the brachial artery. The median nerve gives off an articular branch to the elbow joint. A branch to pronator teres muscle arise from the median nerve immediately above the elbow joint.
Forearm
The median nerve continues in the cubital fossa medial to the brachial artery and passes between the two heads of  the pronator teres, deep to the bicipital aponeurosis (aponeurosis of biceps) and superficial the brachialis muscle. It crosses the ulnar artery (branch of brachial artery) while being separated by the deep head of the pronator teres. It then travels between the flexor digitorum superficialis (above) and flexor digitorum profundus (below). The median nerve is accompanied by the median artery (a branch of anterior interosseous artery) during this course. Then,  about 5 cm above the flexor retinaculum (wrist), it emerges between the flexor digitorum superficialis (medially) and the flexor carpi radialis (laterally) into the hand.The main trunk of the median nerve innervates the superficial and deep groups of the muscles in the anterior compartment of the forearm with the exception of flexor carpi ulnaris. The median nerve does this by giving off two branches as it courses through the forearm:

Muscular branches are given off in the cubital fossa to supply flexor carpi radialis, palmaris longus, and flexor digitorum superficialis. The anterior interosseous branch is given off in the upper part of the forearm, courses with the anterior interosseous artery and innervates flexor pollicis longus and the lateral half of flexor digitorum profundus (the ulnar half is supplied by ulnar nerve, as is the flexor carpi ulnaris muscle). It ends with its innervation of pronator quadratus.