Why My slider shortcode display above header

You need to return the value from the output buffer, like this:

//slider shortcode
function slider_shortcode($atts) {
    extract( shortcode_atts( array(
            'id' => ''), $atts));
        $id = $id;
        ob_start();?>
    <div class="gallary">  
        <?php  
          // Check rows exists.
         if( have_rows('slider',$id) ):

            // Loop through rows.
            while( have_rows('slider',$id) ) : the_row();
                $slider_image = get_sub_field('slider_image');
                $slider_heading = get_sub_field('slider_heading');
                $slider_text = get_sub_field('slider_text');
                $slider_button = get_sub_field('slider_button');
                $slider_button_link = get_sub_field('slider_button_link');?>
            <div>
                <div class="display">
                    <div class="text">
                        <h3><?php echo $slider_heading; ?></h1>
                        <p><?php echo $slider_text; ?></p>
                        <a class="shop_now" href="<?php echo $slider_button_link;?>" class="btn_slide"><?php echo $slider_button; ?></a>
                    </div>
                    <div class="image">
                            <img class="p_image" src="<?php echo $slider_image; ?>"/>
                    </div>
                </div>
            </div>    
            <?php

        // End loop.
        endwhile;

    // No value.
    else :
       
    endif;
    ?>
    </div>
<?php
    $output_string = ob_get_contents();
    ob_end_clean();
    return $output_string;
}
add_shortcode('carousel', 'slider_shortcode');

I’ve added those lines to the very end of your function:

$output_string = ob_get_contents();
ob_end_clean();
return $output_string;